|
well.. i am still searching for the answer thou..
Audrey
|
|
|
|
|
The government is paying pretty good if you're an executive at a failed US bank or automotive manufacturer.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
From the bank.
Samir R. Ibrahim
|
|
|
|
|
1) Bid on project X on rentacoder.
2) Come here and ask "HOW TO DO X IN VB. URGENT. CODE PLZ!!"
3) Profit!
|
|
|
|
|
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
|
|
|
|
|
Do you need to use an external batch file?
Can you not use the network classes from the framework directly?
|
|
|
|
|
sadly im kinda new to this so its the only way i new
i could try another way.
could you go into more detail
|
|
|
|
|
I use this code
If DataGridView1.RowCount> 0 Then
If DataGridView1.Rows(0).Cells("nadnica").Value <>Nothing Then
CheckBox1.Enabled = True
Else
CheckBox1.Enabled = False
End If
End If
and I want when type first letter in cell DataGridView1.Rows(0).Cells("nadnica") execute
how make this thanks
|
|
|
|
|
You should choose variable names that make your code readable. If you have a textbox in a cell, it will have a text changed event.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes variable is textbox but have some event - CellValueChange, CellBeginEdit, CurrentCellChange etc but noone of this work
|
|
|
|
|
Better u can use "Infragistics" "UltraWinGrid" control to solve this problem. There is a "CellChange" event, this event fire when u start typing the first letter itself.
|
|
|
|
|
OK where is found UltraWinGrid or Infragistics
|
|
|
|
|
|
Trying asking this question on their forums.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi All
I had used Collection object to much in vb6 and VFP (They are the same), and recently I tried to the collection in VB.Net which I noticed that in VB.Net it differ totally from vb6.
- I am used to use GetKey() to handle things and search.
- There is no GetKey() now.
- I search and Found HashTable which has Keys in it but they are populated as array.
- Finally, I got what I want by using "Scripting.Dictionary"
Cannot I use the old Collection object (the one in vb6) in VB.Net?
TIA
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: Cannot I use the old Collection object (the one in vb6) in VB.Net?
No, you can't.
Which collection you use depends on how you want to work with the collection and what you're storing in it.
If you've already found the Dictionary collection (which is a Key/Value pair store), what's the problem??
|
|
|
|
|
Dave Kreskowiak wrote: No, you can't.
I begin to wonder that you hate me.
All your replies to me, "No","No, You can't", "No, Not At All", and if you are in good mode you say "It is possible"
Just kidding
Samir R. Ibrahim
|
|
|
|
|
Hello,
Here is a verry easy example of my problem :
Code :
Dim d As Object = Nothing
If d Is Nothing Then
MsgBox("1")
End If
If d = Nothing Then
MsgBox("2")
End If
If 0 = Nothing Then
MsgBox("3")
End If
Show 1,2 and 3.
what is the difference between "is" and "=" ?
Nothing = 0 ?
Thanks.
|
|
|
|
|
You use 'Is' when checking for equality on reference types and '=' when checking for equality on value types.
Not entirely sure why 'Is' and '=' works with Object but I'm guessing it's because Object could be either a reference type or a value type.
|
|
|
|
|
I don't see any difference in the first two. 3rd one will always evaluate as TRUE and compiler may change the code like
If True Then
MsgBox("3")
End If
|
|
|
|
|
The "=" and "<>" operators test whether the operands refer to identical objects; the "Is" and "IsNot" operators test whether the operands refer to the same object. Note that many types objects do not support direct equality testing with the "=" and "<>" operators. I would advise against using "=" or "<>" with objects other than those with explicit support for such semantics (e.g. strings).
|
|
|
|
|
"=" represents the string values
"is" represents the object type values
|
|
|
|
|
I'm attempting to convert the following VB6 code. The code is going to position 675 in a binary file and reading in a numeric value. The returned numeric value is a pointer to a place in the same file where to start reading in data (gRecord is a UDT setup with fixed length strings and integer values). The numeric value will vary from file to file to determine where the data is stored.
VB6 Code:
Dim intFile As Integer
intFile = FreeFile
Open txtWinIGPath.Text & strFilename For Binary As #intFile
'First record location. Offset-1 of first record is stored at location 675
Get #intFile, 675, lngPos
Debug.Print lngPos (in this particular file its 702)
lngPos = lngPos + 1
Do While Not EOF(intFile)
Get #intFile, lngPos, gRecord
I'm reading in the file with this code. I'm reading 11 bytes just to see the data. I'm not getting any value near 758 (even with doing conversions).
.Net code:
Using fs As New FileStream(strFilePath, FileMode.Open, FileAccess.Read), br As New BinaryReader(fs)
fs.Seek(674, SeekOrigin.Begin)
ReDim byt(10)
byt = br.ReadBytes(10)
Here is the raw data displayed through UltraEdit (included 1 line up and down of data).
Can someone explain what I am doing wrong here?
|
|
|
|
|
Hi,
Try seeking on the BinaryReader BaseStream instead of the FileStream. I haven't tested it but I think that's the way to go.
Alan.
|
|
|
|
|
Thanks for the reply,
The only seek I can find on the binary reader is the "br.BaseStream.Seek", which I assume is doing the fs.seek.
So confused on this one - lol.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|