P
Patrick
Hello, after learning that I was taking a class in VB.NET, I have been
drafted to solve all my companies VB/scripting problems - hey, I should know
everything; I've already taken 6 classes I should have been quiet about
it, but then I would never be reimbursed. Oh well.
I have been asked to write a program to ping a NetBIOS name, get the IP, and
compare the 3rd octet to a list to get the computer's location. So far, I
can ping the IP, save the output to a text file, and open the file, but I am
having trouble stripping out the IP address. My code is as follows:
Private Sub ConvertButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConvertButton.Click
' Click a button, it takes the value of NetBiosBox and pings it, then
' saves the output to c:\vb\test2.txt
Dim RedirectFile As Object
RedirectFile = "c:\vb\test2.txt"
Shell(Environ$("comspec") & " /k ping " & Me.NetBiosBox.Text & " > """ &
RedirectFile & """", AppWinStyle.Hide)
' Here is where I open the file - but how do I get the data I need? All
samples I have assume fixed file sizes, etc.
FileOpen(1, "c:\vb\test2.txt", OpenMode.Binary, OpenAccess.Default,
OpenShare.Shared)
FileClose(1) ' Close file.
I can do comparisons, I'm pretty sure the docs I have for opening files are
thorough, and I feel I'm on the right track. Any help with the stripping out
of the IP would be appreciated. Thanks! If this is the wrong place for
questions like this - let me know where.
drafted to solve all my companies VB/scripting problems - hey, I should know
everything; I've already taken 6 classes I should have been quiet about
it, but then I would never be reimbursed. Oh well.
I have been asked to write a program to ping a NetBIOS name, get the IP, and
compare the 3rd octet to a list to get the computer's location. So far, I
can ping the IP, save the output to a text file, and open the file, but I am
having trouble stripping out the IP address. My code is as follows:
Private Sub ConvertButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConvertButton.Click
' Click a button, it takes the value of NetBiosBox and pings it, then
' saves the output to c:\vb\test2.txt
Dim RedirectFile As Object
RedirectFile = "c:\vb\test2.txt"
Shell(Environ$("comspec") & " /k ping " & Me.NetBiosBox.Text & " > """ &
RedirectFile & """", AppWinStyle.Hide)
' Here is where I open the file - but how do I get the data I need? All
samples I have assume fixed file sizes, etc.
FileOpen(1, "c:\vb\test2.txt", OpenMode.Binary, OpenAccess.Default,
OpenShare.Shared)
FileClose(1) ' Close file.
I can do comparisons, I'm pretty sure the docs I have for opening files are
thorough, and I feel I'm on the right track. Any help with the stripping out
of the IP would be appreciated. Thanks! If this is the wrong place for
questions like this - let me know where.