A Conumdrum in VB Express 2005

G

Guest

Hi friends:

I am using Visual Basic Express 2005 (just migrated from vb6) and I
have come across a strange conumdrum:
I am doing a process start and then it waits for it to finish before
moving on.
The reason I do this is because I have software written in old archaic
languages and I dont have access to the source code so good ole batch
will have to do. Note I am using a BATCH file, not an exe.
This BATCH file calls the proprietary software passing in command line
arguments.

My code is as follows:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click
PATH = txtPATH.Text
Call WriteSATfile()
MessageBox.Show("DONE") 'this is to check that this line of
code doesnt execute before the process completes
End Sub

Public Sub WriteSATfile()
Dim p As Process
'open the file and close it
'this makes sure that if it was already filled with data it
will be killed
Dim FreeFNum As Integer = FreeFile()
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Output)
FileClose(FreeFNum)
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Append)
PrintLine(FreeFNum, "PATH=%path%;" & PATH)
PrintLine(FreeFNum, "CALL DORUNSKIM") 'this is the batch file
I am calling
FileClose(FreeFNum)
Dim temp As String
p = Process.Start( FPath & "\" & "temp.bat")
p.WaitForExit()
End Sub

The conumdrum happens to be this: If I use the debug mode in Visual
Basic Express 2005, the code does not work! However, if I actually
build this code, it runs!!! why is that?

Many thanks for any help the experts out there can give.
 
G

Guest

Hi friends:

I am using Visual Basic Express 2005 (just migrated from vb6) and I
have come across a strange conumdrum:
I am doing a process start and then it waits for it to finish before
moving on.
The reason I do this is because I have software written in old archaic
languages and I dont have access to the source code so good ole batch
will have to do.  Note I am using a BATCH file, not an exe.
This BATCH file calls the proprietary software passing in command line
arguments.

My code is as follows:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click
        PATH = txtPATH.Text
        Call WriteSATfile()
       MessageBox.Show("DONE")  'this is to check that this line of
code doesnt execute before the process completes
End Sub

    Public Sub WriteSATfile()
        Dim p As Process
        'open the file and close it
        'this makes sure that if it was already filled with data it
will be killed
        Dim FreeFNum As Integer = FreeFile()
        FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Output)
        FileClose(FreeFNum)
        FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Append)
        PrintLine(FreeFNum, "PATH=%path%;" & PATH)
        PrintLine(FreeFNum, "CALL DORUNSKIM") 'this is the batch file
I am calling
        FileClose(FreeFNum)
        Dim temp As String
        p = Process.Start( FPath & "\" & "temp.bat")
        p.WaitForExit()
    End Sub

The conumdrum happens to be this: If I use the debug mode in Visual
Basic Express 2005, the code does not work! However, if I actually
build this code, it runs!!! why is that?

Many thanks for any help the experts out there can give.

Making a stupid mistake.....well..I know why now....because I did not
chdir to my working directory....
Lesson learnt!!!
 
M

Michael Williams

While you're at it, take a look at the System.IO.StreamReader
and System.IO.StreamWriter classes. The work similarly to the
FileSystemObject's File io and provide cleaner and faster
performance than the legacy VB functions for file io.

Are you referring to a specific set of published speed tests, or are you
just making it up?

Mike
 
C

Cor Ligthert[MVP]

My empirical experience with the file io. If they aren't faster, they
certainly are easier to use. The biggest performance bottleneck of any
file io is the disk subsystem, which obviously doesn't change.

Mike.

I think that this is better writen then your first statement, however even
that is very subjective.

I do it like you, but I can imagen that somebody who wants to go on with
what he always did, will use the way as he did in Visual Basic before
version 7, and I don't know what is wrong with that, let not forget that as
it is not about Com objects and Api's VB6 and its successors are in the
program language very much the same (much more then I like at least).

jmo

Cor
 
C

Clive Lumb

Michael Williams said:
Are you referring to a specific set of published speed tests, or are you
just making it up?

Mike

FFS you guys are so aggressive!
It makes reading this NG a real pain. If you disagree with someone, please
have the decency to do so politely and with a reasoned counter-argument.
 
M

Michael Williams

My empirical experience with the file io. If they aren't faster, they
certainly are easier to use. The biggest performance bottleneck of any
file io is the disk subsystem, which obviously doesn't change.

So you're making it up then.

Mike
 
M

Michael Williams

I do it like you, but I can imagen that somebody who wants
to go on with what he always did, will use the way as he did
in Visual Basic before version 7, and I don't know what is
wrong with that, let not forget that as it is not about Com
objects and Api's VB6 and its successors are in the program
language very much the same (much more then I like at least).

That's a very clever way of wrapping a small note of agreement in a
paragraph full of disagreement and inaccuracies. Well done. You almost had
me fooled for a minute ;-)

Mike
 
M

Michael Williams

FFS you guys are so aggressive! It makes reading this NG
a real pain. If you disagree with someone, please have the
decency to do so politely . . .

I /did/ do so politely. If you think my response (shown above) was impolite
then you've led a very sheltered life.
. . . and with a reasoned counter-argument.

Why should I be required to provide a reasoned counter argument to an
unreasoned statement that contained an opinion based on no valid argument at
all. You are obviously biased.

Mike
 
C

Clive Lumb

Michael Williams said:
I /did/ do so politely. If you think my response (shown above) was
impolite then you've led a very sheltered life.


Why should I be required to provide a reasoned counter argument to an
unreasoned statement that contained an opinion based on no valid argument
at all. You are obviously biased.

Yes, I am biased in favour of politeness.
I have absolutely no opinion about the relative speed of the Stream & VB io
methods.
However I do have an opinion about pointed and sarcastic comments in what is
after all meant to be a group about mutual help and advice.
I am not defending anyone nor pointing fingers at culprits but I am afraid
that your reaction only underlines the aggression that is rife here.
I have not lived a sheltered life, I know what a proper flame-war looks
like - and I still think that many comments here are impolite.

We are all adults, we are discussing a programming language - not the
relative merits of football teams - so if you disagree with someone's
statement you should say so (politely) and say why. A good technical
discussion will teach many, while a "are you just making it up?" leaves
doubt in the mind of the less-informed reader.

As for being biased... you obviously think that I am siding with someone,
nothing could be further from the truth. I am a part-time programmer using
VB6, VS2008, PHP, MYSQL and a bit of Java; no connection with any software
companies, not a fanboi of any particular language or editor.

I shall leave my comments at that, if you feel the need to reply with other
unfounded accusations please do, but I will not reply as it only defeats the
initial object of my post.
 
M

Michael Williams

We are all adults, we are discussing a programming
language - not the relative merits of football teams -
so if you disagree with someone's statement you should
say so (politely) . . .

I /did/ say so politely. I have already told you that. Have you forgotten
already? Besides, if the discussion was about football teams I would not be
part of it at all because I am not in the slightest bit interested in
football. However, I really don't know why you think, as you appear to do,
that people who do follow football teams have a right to be rude to each
other. Is that really your opinion?
. . . and say why. A good technical discussion will teach many

Does this rule of yours apply only to me, or does it also apply to Michael D
Ober, the person to whom I was responding? If it does apply to him as well
then you have forgotten to chastise him, and many others, in the same way
that you personally chastised me for ignoring your rule. If you are going to
personally chastise an individual for failing to comply with your rules then
please have the decency to personally chastise everyone in the same manner.
As for being biased... you obviously think that I am siding with someone

You've got it in one! You are a clever lad.

Mike
 
T

Tom Shelton

Are you referring to a specific set of published speed tests, or are you
just making it up?

Mike

I believe he is refering to the built in VB.NET file IO that was added to make
migration "easier". Not to the VB6 file IO.

In other words, he is comparing the VB.NET FileXXX functions to using
System.IO classes directly. And he is most correct - System.IO is much faster
then FileXXX. And that is a fact I established for myself ages ago (maybe
it's changed in the last several versions :) )

As compared to VB.CLASSIC IO - I would say it's pretty much equivalent, though
I haven't done any comparisons there...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top