cdiaz1116
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 3/4/2010
-
Status: offline
|
Display results of a command in a text box
Friday, May 21, 2010 2:45 AM
( permalink)
I am writing a set of tools and have the need to generate results and show them in the same form. For example. I have a Text box where I would type a host name. When I click ok the script will ping the host name. I want the results of the ping to display on the same form in a text box or Webbrowser control. I have been tinkering with a bunch of ideas but nothing seems to work. Any help would be appricieted.
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 3:05 AM
( permalink)
We'll need to see code to give concrete help but this is certainly doable.
|
|
|
|
cdiaz1116
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 3/4/2010
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 3:28 AM
( permalink)
I tried having the results written to an HMTL file and then have a webbrowser control read the file. Dim objFSO, objFile, DataArea Shell(Command() & "ping.exe " & HostName.Text) objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CreateTextFile("test.htm") objFile = objFSO.OpenTextFile("test.htm", 2) objFile.WriteLine(DataArea.InnerHTML) objFile.Close() I would rather have it go directly to a text box though.
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 3:37 AM
( permalink)
I would suggest searching the forum for HTA. That is what I think you want.
|
|
|
|
cdiaz1116
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 3/4/2010
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 3:50 AM
( permalink)
No Actually Im going from a working HTA and turning it into a VB project. Maybe thats where im going a little crazy.
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 5:20 AM
( permalink)
Aaah...so you are doing this in VB? Just to be clear, VB is not VBScript(VBS) is not VB for Applications is not VB .Net. So which language are you actually using?
|
|
|
|
cdiaz1116
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 3/4/2010
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 7:43 AM
( permalink)
VB. I was looking for a way to directly pipe the result into a text box and bypass the creating and reading of a text file. Creating a text file works. See below. Although I dont know how to create a wait between the ping and the read of the file. Dim strOutFile strOutFile = "c:\deploy\temp.txt" Shell("cmd.exe /c ping.exe " & HostName.Text & " > " & StrOutFile) Dim xFile As String = "c:\deploy\temp.txt" Dim TextLine As String If System.IO.File.Exists(xFile) Then Dim Reader As System.IO.StreamReader = New System.IO.StreamReader(xFile) Do While Reader.Peek() <> -1 TextLine = Reader.ReadToEnd() & vbNewLine TextBox1.Text = TextLine Loop Reader.Close() End If End Sub
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Display results of a command in a text box
Friday, May 21, 2010 7:48 AM
( permalink)
I would not use ping.exe. I would use a call to the wsock32.dll.
|
|
|
|
megna73
-
Total Posts
:
1
- Scores: 0
-
Reward points
:
0
- Joined: 7/26/2010
-
Status: offline
|
Re:Display results of a command in a text box
Monday, July 26, 2010 3:06 PM
( permalink)
Private Sub UsernameTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles UsernameTextBox.Leave 'Make Connection to database Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Atlanet\loantracking\CTS_be.mdb") 'Query information for Branch Number Dim BranchNumber As OleDbCommand = New OleDbCommand("SELECT Branch_Number From MSysUserList WHERE Username like '" & UsernameTextBox.Text & "'") BranchNo.Text = BranchNumber 'Query information for User Group Dim UserGroup As OleDbCommand = New OleDbCommand("SELECT UserGroup From MSysUserList WHERE Username like '" & UsernameTextBox.Text & "'") UserGroupTextBox.Text = UserGroup End Sub Web Development Services
|
|
|
|
ginolard
-
Total Posts
:
1347
- Scores: 23
-
Reward points
:
0
- Joined: 8/11/2005
-
Status: offline
|
Re:Display results of a command in a text box
Sunday, August 15, 2010 7:09 PM
( permalink)
|
|
|
|