|
-
Oct 22nd, 2004, 02:08 AM
#1
Thread Starter
New Member
Dim as long
I am currenty working on a project, what I was is to dim these three txt boxes as long so the "" quotes will stop appearing and interfearing with the cmd file.
Any help out there??
I keeping getting a : "Type Mismatch" error - It highlights the Dim trace and the dim pause. Help!
Private Sub cmdScan_Click()
If Not IsNumeric(txtipadress) Then
MsgBox "Please enter a numeric value only!", vbInformation + vbOKOnly, "Incorrect Information"
txtipadress.SetFocus
End If
Dim telnum As Long
telnum = txtipadress
Dim trace As Long
trace = txttrace
Dim pause As Long
pause = txtPause
filename = "C:\ip.cmd"
Open filename For Output As #1
Write #1, telnum, trace, pause
-
Oct 22nd, 2004, 05:39 AM
#2
The dafault properity of txtipadress.text and that is a string!
If you want to have an IP.address (i.e. "255.255.255.0") you need to change that string into those four numbers(or does a VAR-type IP-address exist?).
The same is probable true for "trace"
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Oct 22nd, 2004, 02:20 PM
#3
Thread Starter
New Member
Why a string?
This code works properly -
Dim telnum As Long
telnum = txtipadress
The other two doesn't work. Why is it a string when I dim it as long - I even dim filename as long. Any help?
-
Oct 22nd, 2004, 06:46 PM
#4
Frenzied Member
Try using Val() or CLng().
Tengo mas preguntas que contestas
-
Oct 22nd, 2004, 07:14 PM
#5
You could just add code to the _KeyPress event and trap for undesireable
characters before they get in.
VB Code:
Private Sub txtIPAddress_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 46, 48 To 57, 8 'Numbers, decimal, and backspace only
Case Else
Beep
KeyAscii = 0 'Cancels the keypressed character
End Select
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 22nd, 2004, 09:30 PM
#6
Thread Starter
New Member
Still lost....
Maybe I didn't explain what was incorrectly as well as I should have - I am trying to get rid of the quotes, when it writes it to a note pad it gives me "Ping"Whatever the IPaddress""@pause". The Ping Quotes are gone, by using the dim telnum as long; and the others - dim trace as long and dim pause as long gives me the error. I changed them to string but again it caused the quotes to come back.
Hey thanks for the other idea taking care of undesirable charactors - helped.
-
Oct 23rd, 2004, 11:40 AM
#7
Oh now I see said the blind man!
Its how you are writting out to your file. The Write statement will
place double quotes around each entry. Use the Print statement
instead. It will not do that.
Snippet:
VB Code:
filename = "C:\ip.cmd"
Open filename For Output As #1
Print #1, telnum, trace, pause
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 24th, 2004, 02:48 AM
#8
Thread Starter
New Member
Got some of it.....
I got the quotes to work, now I was wondering how could I get the @pause command to go below the rest of the code in a txt file? Any ideas?
I.E.
Text goes here
@pause
Thanks for the help all.
-
Oct 24th, 2004, 12:11 PM
#9
Just change the order on the Print line of code. First position is
the last line in the text file.
VB Code:
filename = "C:\ip.cmd"
Open filename For Output As #1
Print #1, pause, telnum, trace
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 24th, 2004, 11:15 PM
#10
Thread Starter
New Member
Last Line...
Not needed after the rest of the words, I need it below - And BTW - The print doesn't work, just gives me: "","","" No matter what I type.
-
Oct 25th, 2004, 09:43 AM
#11
Hyperactive Member
You can either put it as a separate Print statement
Print #1, Pause
Print #1, Telnum
etc
Or Print #1, Pause & vbCrLf & Telnum......
-
Oct 31st, 2004, 12:20 AM
#12
Thread Starter
New Member
???
Is what I am trying to do impossable? Or is there another way to attack this thing?
-
Nov 6th, 2004, 01:15 PM
#13
Thread Starter
New Member
Guess not
Okay, I figured out my last problem by myself, but a new one has risen from it's death.
And the crazy thing is it worked for me one time and when I typed the code back in perfectly as before, it gave me some kinda error, please help!!!!!
All I want to do at the moment is open a program and have it run through VB -
The following code has been used and given a error message of - "Invalid Call or argument"
Dim a
'1 stands for open that exe
a = Shell("H:\windows\system32\command.cmd", 1)
End
That doesn't work - and here is the other-----
Open ("H:\windows\system32\command.cmd") For Append As 1
This code too doesn't work and gives me an error message
The command.cmd does exist as I made it before I wrote the code.
Finally, I tried creating it -
open ("H:\windows\system32\command.cmd") for output as 1
and then open it
dim a
a = shell("H:\windows\system32\command.cmd")
Still no such luck, the wierd thing is the dim a command actually worked one time and when I did it again without altering the code it didn't work, and now it never works. I have gone as far as rebooting my system to clear the memory.... Any help please?!?!?
Thanks
-Phil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|