473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

process.* works in designer but not stand alone

Hello - I have put together a little app that fires of a DOS program and
redirects the output of the DOS program to a textbox.
All is well and fine while I am in Visual Studio and run in debug. Redireted
DOS output displays properly in he textbox.
I am starting the DOS porgram with a process using .startinfo and friends.

Once I try to run the same executable from windows the redirected output no
longer displays in the textbox.

Has anyone else seen this and have any ideas?

Thanks,
Thom
Nov 20 '05 #1
5 1001
"Thom" <la*****@charter.net> schrieb:
redirects the output of the DOS program to a textbox.
All is well and fine while I am in Visual Studio and run in debug.
Redireted DOS output displays properly in he textbox.
I am starting the DOS porgram with a process using
.startinfo and friends.

Once I try to run the same executable from windows the
redirected output no longer displays in the textbox.


Hard to say without knowing anything about your code...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Sorry Herfried.....alot of this should look famiilar to you as I found bits
of it at
http://dotnet.mvps.org/dotnet/sample...ectConsole.zip

ElseIf Me.btnNetwork.Checked = True Then
mProcess = New Process
With mProcess.StartInfo
.FileName = "repstore.exe"
.Arguments = "3104"
.CreateNoWindow = True
.UseShellExecute = False
.RedirectStandardInput = True
.RedirectStandardOutput = True
End With
mProcess.Start()
Dim ts1 As ThreadStart = New ThreadStart(AddressOf StreamOutput)
mOutputStream = New Thread(ts1)
mOutputStream.Start()

blah blah other stuff....

Private Sub StreamOutput()
Dim strLine As String = mProcess.StandardOutput.ReadLine()
Try
Do While strLine.Length >= 0
If strLine.Length <> 0 Then
AddText(strLine)
End If
strLine = mProcess.StandardOutput.ReadLine()
Loop
Catch
End Try
End Sub

Private Sub AddText(ByVal strText As String)
mStrText = strText
Me.Invoke(CType(AddressOf Me.addTextToTextBox, MethodInvoker))
Dim fileNametoOpen, testChar As String
Dim found, intboxLength, intx, inty, intz As Integer
If strText.EndsWith(".txt") Then 'check for a textfile then put in
the textbox.
intboxLength = strText.Length
inty = intboxLength
For intx = intboxLength To 0 Step -1
found = strText.IndexOf(" ", inty)
If found > 0 Then
fileNametoOpen = strText.Substring(found + 1, intz - 1)
Call AddTextFromfile(fileNametoOpen)
Exit For
End If
intz = intz + 1
inty = inty - 1
Next intx
End If
End Sub

Private Sub addTextToTextBox()
Me.TextBox2.AppendText(mStrText & ControlChars.NewLine)
Me.TextBox2.SelectionStart = Me.TextBox2.Text.Length
End Sub
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u%******************@TK2MSFTNGP09.phx.gbl...
"Thom" <la*****@charter.net> schrieb:
redirects the output of the DOS program to a textbox.
All is well and fine while I am in Visual Studio and run in debug.
Redireted DOS output displays properly in he textbox.
I am starting the DOS porgram with a process using
.startinfo and friends.

Once I try to run the same executable from windows the
redirected output no longer displays in the textbox.


Hard to say without knowing anything about your code...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
"Thom" <la*****@charter.net> schrieb:
Sorry Herfried.....alot of this should look famiilar to you
as I found bits of it at

http://dotnet.mvps.org/dotnet/sample...ectConsole.zip

;-)

I am not able to see a difference when running the app inside the IDE or
outside the IDE, or switching between Debug and Releaser mode. What
application are you starting? Are you sure you don't access controls
directly from the different threads? You will have to use 'Control.Invoke'
or 'Control.BeginInvoke' to do that.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4
IF you are interested I can send the app to you. It is a little network
aware program for transferring data via a protocol called DICOM -- a medical
imaging thing.
The app fires and receives data but the data is not posted to the interface.
Let me know if you would like the app -- that may be the only way to see the
difference from within the IDE and outside of the IDE.

Thank you for your efforts. The app is about 421k in size.

Thom

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
"Thom" <la*****@charter.net> schrieb:
Sorry Herfried.....alot of this should look famiilar to you
as I found bits of it at

http://dotnet.mvps.org/dotnet/sample...ectConsole.zip
;-)

I am not able to see a difference when running the app inside the IDE or
outside the IDE, or switching between Debug and Releaser mode. What
application are you starting? Are you sure you don't access controls
directly from the different threads? You will have to use 'Control.Invoke' or 'Control.BeginInvoke' to do that.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5
Hello -- I chanced upon a little luck. I now have my app working properly.
I added .RedirectStandardError = True to my form load function

so now it is :
mProcess = New Process
With mProcess.StartInfo
.FileName = "repstore.exe"
.Arguments = "3104"
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.RedirectStandardInput = True
End With

Thank you for your help.

Thom

"Thom" <la*****@charter.net> wrote in message
news:10*************@corp.supernews.com...
IF you are interested I can send the app to you. It is a little network
aware program for transferring data via a protocol called DICOM -- a medical imaging thing.
The app fires and receives data but the data is not posted to the interface. Let me know if you would like the app -- that may be the only way to see the difference from within the IDE and outside of the IDE.

Thank you for your efforts. The app is about 421k in size.

Thom

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
"Thom" <la*****@charter.net> schrieb:
Sorry Herfried.....alot of this should look famiilar to you
as I found bits of it at

http://dotnet.mvps.org/dotnet/sample...ectConsole.zip

;-)

I am not able to see a difference when running the app inside the IDE or
outside the IDE, or switching between Debug and Releaser mode. What
application are you starting? Are you sure you don't access controls
directly from the different threads? You will have to use

'Control.Invoke'
or 'Control.BeginInvoke' to do that.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: none | last post by:
Howdy all, I'm wondering if someone could give some direction on a problem I have or share their experiences. I'm wanting to create a little PHP application that will run on a local machine...
1
by: Camiel | last post by:
Hi, I'm trying to do the following: create a form, with at the top a list of values drop-down box, filled with values from table A. Also at the top, an input box to enter a year. Below...
0
by: Stephen.Haeney | last post by:
I am deveeloping a WinForm application where I need to display a HTML page to the user. I would like to use IE to display this page then wait until they have closed the IE window before continuing...
2
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void...
1
by: BenS | last post by:
Good Morning and Happy Wednesday! I've got a web service that exposes a method that takes an string input parameter that specifies an executable on the server that starts a process. These...
4
by: Phil Mc | last post by:
Say for example you have a application running on a windows 2003 server (that is on server, not from). This application needs to start child applications (must be stand alone console applications),...
5
by: Rob R. Ainscough | last post by:
I'm using the Diagnostics.Process approach to shelling out run the following: C:\Windows\System32\MSIEXEC.EXE /x {73F1BDB7-11E1-11D5-9DC6-00C04F2FC33B} /q ..FileName =...
8
by: Henrik | last post by:
Hi Is there any way to see what the System process is doing? We have developed an application running at a production site to measure and optimize the production. The application needs to be...
13
by: Edwin Smith | last post by:
I have a form which displays a DataGridView table generated with the VS2005 tools. The database is a Pervasive v.9 with an ODBC driver. The DataGridView works great except when I'm done and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.