Click here to Skip to main content
16,013,747 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to get Pin
Eddy Vluggen16-Feb-09 21:35
professionalEddy Vluggen16-Feb-09 21:35 
AnswerRe: how to get Pin
Steven J Jowett17-Feb-09 1:19
Steven J Jowett17-Feb-09 1:19 
GeneralRe: how to get Pin
Eddy Vluggen17-Feb-09 3:04
professionalEddy Vluggen17-Feb-09 3:04 
AnswerRe: how to get Pin
Agus Budianto17-Feb-09 3:58
Agus Budianto17-Feb-09 3:58 
AnswerRe: how to get Pin
Jon_Boy17-Feb-09 4:20
Jon_Boy17-Feb-09 4:20 
AnswerRe: how to get Pin
Samir Ibrahim17-Feb-09 4:38
Samir Ibrahim17-Feb-09 4:38 
AnswerRe: how to get Pin
Mark Churchill17-Feb-09 14:17
Mark Churchill17-Feb-09 14:17 
Questionmodifying and displaying text from text file depending on content Pin
todda200816-Feb-09 9:01
todda200816-Feb-09 9:01 
hi,
sorry if this sounds a stupid question but im a beginer so bare with me this is my first non guide based project.

im writing a program that creates a batch file from user entered data.
it then runs and saves the batch file text + result as a text file.
it then displays the text file in a textbox.
this was fine but im trying to develop it further so i now need it to be more simple for the user with more features.
the user can now choose how many times (1-10) the batchfile requests the data.
this works well but the data returned is a complicated unformatted mess.

i would like if possible for the program to read the final text file and return simple formatted results.
eg: instead of "exact returned result for 5x run..
Pinging 192.168.1.1 with 32 bytes of data:Reply from 192.168.1.1: bytes=32 time=24ms TTL=64Reply from 192.168.1.1: bytes=32 time=3ms TTL=64Reply from 192.168.1.1: bytes=32 time=3ms TTL=64Reply from 192.168.1.1: bytes=32 time=3ms TTL=64Reply from 192.168.1.1: bytes=32 time=3ms TTL=64Ping statistics for 192.168.1.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 3ms, Maximum = 24ms, Average = 7ms

i would prefer just
ping to 192.168.1.1 sucessful 3ms
ping to 192.168.1.1 sucessful 3ms
ping to 192.168.1.1 sucessful 3ms
ping to 192.168.1.1 sucessful 3ms
ping to 192.168.1.1 sucessful 3ms

and to say it failed for eg: "ping to 192.168.1.1 failed"
i know theres more possible results but i'll sort that out later.

i havnt a clue how to do this ive looked high and low but nothing works how i want as the data is completely different everytime.
heres the process code so you can see where im at..

the reason its doubled up is it can ping to IP and name, i just found it easyier that way


Private Sub Button1_Click() Handles Button1.Click

Dim pingamount As Integer

pingamount = NumericUpDown1.Value

If RadioButton1.Checked = True Then

If TextBox1.Text.Length = 0 Or TextBox2.Text.Length = 0 Or TextBox3.Text.Length = 0 Or TextBox4.Text.Length = 0 Then

MsgBox("please enter a valid IP address")

Else : TextBox5.Text = ""

If Form3.TextBox1.TextLength = True Then Form3.Close()

Dim fs As New FileStream("C:\ping.bat", FileMode.Create, FileAccess.Write)

Dim s As New StreamWriter(fs)

s.WriteLine("ping.exe -n " & pingamount & " " & TextBox1.Text & "." & TextBox2.Text & "." & TextBox3.Text & "." & TextBox4.Text & ">C:\ping.txt")

s.Close()

Shell("C:\ping.bat")

Threading.Thread.Sleep(pingamount * 5000)

fs = New FileStream("C:\ping.txt", FileMode.Open, FileAccess.Read)

Dim d As New StreamReader(fs)

d.BaseStream.Seek(0, SeekOrigin.Begin)

While d.Peek() > -1

TextBox5.Text &= d.ReadLine()

End While

d.Close()

Me.Visible = False

Dim f3 As New Form3

f3.Show()

Form3.TextBox1.Text = TextBox5.Text

End If

End If

If RadioButton2.Checked = True Then

If TextBox7.Text.Length = 0 Then

MsgBox("please enter a valid name")

Else : TextBox5.Text = ""

If Form3.Visible = True Then Form3.Close()

Dim fs As New FileStream("C:\ping.bat", FileMode.Create, FileAccess.Write)

Dim s As New StreamWriter(fs)

s.WriteLine("ping.exe -n " & pingamount & " " & TextBox7.Text & ">C:\ping.txt")

s.Close()

Shell("C:\ping.bat")

Threading.Thread.Sleep(pingamount * 5000)

fs = New FileStream("C:\ping.txt", FileMode.Open, FileAccess.Read)

Dim d As New StreamReader(fs)

d.BaseStream.Seek(0, SeekOrigin.Begin)

While d.Peek() > -1

TextBox5.Text &= d.ReadLine()

End While

d.Close()

Me.Visible = False

Dim f3 As New Form3

f3.Show()

Dim fivetext As String

fivetext = TextBox5.Text

Form3.TextBox1.Text = fivetext

End If

End If

End Sub
AnswerRe: modifying and displaying text from text file depending on content Pin
DaveAuld16-Feb-09 23:50
professionalDaveAuld16-Feb-09 23:50 
GeneralRe: modifying and displaying text from text file depending on content Pin
todda200817-Feb-09 13:17
todda200817-Feb-09 13:17 
Questionwho is event Pin
ivo7516-Feb-09 8:14
ivo7516-Feb-09 8:14 
AnswerRe: who is event Pin
Christian Graus16-Feb-09 11:52
protectorChristian Graus16-Feb-09 11:52 
GeneralRe: who is event Pin
ivo7516-Feb-09 19:30
ivo7516-Feb-09 19:30 
AnswerRe: who is event Pin
kvelu.d16-Feb-09 21:06
kvelu.d16-Feb-09 21:06 
GeneralRe: who is event Pin
ivo7516-Feb-09 23:28
ivo7516-Feb-09 23:28 
GeneralRe: who is event Pin
kvelu.d16-Feb-09 23:57
kvelu.d16-Feb-09 23:57 
GeneralRe: who is event Pin
Jon_Boy17-Feb-09 4:22
Jon_Boy17-Feb-09 4:22 
QuestionCollection in VB6 and VB.Net Pin
Samir Ibrahim16-Feb-09 7:42
Samir Ibrahim16-Feb-09 7:42 
AnswerRe: Collection in VB6 and VB.Net Pin
Dave Kreskowiak16-Feb-09 10:13
mveDave Kreskowiak16-Feb-09 10:13 
GeneralRe: Collection in VB6 and VB.Net Pin
Samir Ibrahim16-Feb-09 19:34
Samir Ibrahim16-Feb-09 19:34 
QuestionIs Vs = and nothing Pin
thesum16-Feb-09 5:23
thesum16-Feb-09 5:23 
AnswerRe: Is Vs = and nothing Pin
Jay Royall16-Feb-09 5:40
Jay Royall16-Feb-09 5:40 
AnswerRe: Is Vs = and nothing Pin
N a v a n e e t h16-Feb-09 5:57
N a v a n e e t h16-Feb-09 5:57 
AnswerRe: Is Vs = and nothing Pin
supercat916-Feb-09 8:12
supercat916-Feb-09 8:12 
AnswerRe: Is Vs = and nothing Pin
kvelu.d16-Feb-09 20:51
kvelu.d16-Feb-09 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.