|
-
Apr 19th, 2009, 10:25 PM
#1
Thread Starter
New Member
[RESOLVED] Conversation Error
Code:
Public Class Form1
Private Sub Btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1.Click
Dim strCode As String
Dim myobj As Object, program
myobj = CreateObject("wscript.shell")
myobj = myobj.exec("cmd /c c:\myDosProgram.exe") 'your shell command
Do
With myobj
With .StdOut
If Not .AtEndOfStream Then
strCode = .readall()
End If
End With
End With
'DoEvents()
Loop While myobj.Status = "WshRunning"
myobj = Nothing
End Sub
End Class
Conversion from string "WshRunning" to type 'Double' is not valid.
anyone got any idea what i should do to my codes to make it works ?
-
Apr 20th, 2009, 12:38 AM
#2
Re: Conversation Error
Are you trying to convert to .Net or VB6?
-
Apr 20th, 2009, 01:25 AM
#3
Thread Starter
New Member
Re: Conversation Error
nope. im using microsoft visual studio 2005
-
Apr 20th, 2009, 02:28 AM
#4
Re: Conversation Error
The Status property returns a value from an enumerated type.
WshRunning ( = 0) : The job is still running.
WshFinished ( = 1): The job has completed.
Declare: Const WshRunning = 0
then replace "WshRunning" with WshRunning
or replace "WshRunning" with 0
Loop While myobj.Status = 0
-
Apr 20th, 2009, 02:35 AM
#5
Re: Conversation Error
Welcome to the VBForums.
If you have questions on VB.NET (which Visiual Studio 2005 is) you'd better post such questions in the Forum "Visual Basic .Net".
I believe you copied that code/ or parts of it somewhere. You missid to copy the declaration of WSHRunnig. Something like:
Code:
Const WshRunning = 0
WshFinished = 1
WshFailed = 2
With this declaration you can use WSHRunning without the ""!
Damm it, somebody was faster.
Last edited by opus; Apr 20th, 2009 at 02:36 AM.
Reason: A Head Hunter passed in the middle of writing.
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!
-
Apr 20th, 2009, 03:11 AM
#6
Thread Starter
New Member
Re: Conversation Error
ok thx. i did copied the codes. and sry abt psoting at the wrong forum. didnt know visual studio 2005 is vb.net
-
Apr 20th, 2009, 11:29 AM
#7
Re: Conversation Error
Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum
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
|