Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey everyone!
I need some help and I would highly appriciate it if someone could help me with this.
I'm trying to make a website IP address finder, and I have the style and the method of getting it... But not the coding...
I have...
3 Labels
2 Textboxs
and 1 Button.I want it to notice that there is a website in textbox1 (If no website then Button1.Enabled = False), and when button1 is clicked, it opens up CMD (But hidden!) and it types this in CMD : Ping "Website from textbox1" (Without Quotes). From there I want it to locate the IP address in CMD and Put it in Textbox2.
Can anyone help me?
Thanks!

Sorry about that, I'm using VB Express Edition 2008.
I want to analyze the code so I can get better... and make a website IP finder, haha. I'm having a hard time finding a good place for tutorials that I need.
And this isn't homework haha.

I know I've answered a similar question before, but I never have any luck with this site's search. (Am I the only one?)
Thankfully, I still have my example, so after putting in a few lines of my example code, I found the thread. The only other thing I'd add is nslookup would be better than ping.

Hey Razor,
Thanks for you post, I'm having a problem with the code. I've copied & Pasted it and it doesn't work =[
Can you tell me how to type in CMD using VB, How to hide CMD while it is finding the IP, and how to get the IP from CMD to VB (TextBox2) please??
This is the code I have so far...
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Enabled = True Then Shell("cmd.exe")
End SubPrivate Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = "www" Or TextBox1.Text = "http:/" Then Button1.Enabled = False
If TextBox1.Text = "www." Or TextBox1.Text = "http://" Then Button1.Enabled = True
End SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class

It works perfectly for me. Just start a new Windows project, view the code of Form1, delete all of the text, then paste my example in. The Design View won't show anything, but you'll get a text box and button when you run it.
EDIT:
Can you tell me how to type in CMD using VB, How to hide CMD while it is finding the IP, and how to get the IP from CMD to VB (TextBox2) please??
Question 1 and 2 are answered in Private Sub Btn_Click, while question 3 is answered across the entire example, excluding Public Sub New and Private Sub Proc_Exited

Thanks Razor!
My computer's being gay and won't paste it properly, but I'll try copy the txt line to line, and see if that works, But that's some help.

Ah, you're using IE6. This site has some bugs when it comes to the pre tag that blow up in IE6. Try pasting it into WordPad first, then VS. Or get a different browser.

Thanks Razor!!!!!!!
I couldn't copy it properly so did it line for line and works like a charm!!!To all other people out there, Razor is the best!!!
Thanks again!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |