Name: Eprouvez Date: May 2, 2008 at 00:42:29 Pacific Subject: HELP! Running CMD command in VB OS: XP PRO CPU/Ram: 768 Model/Manufacturer: Compaq
Comment:
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.
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.
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 Sub
Private 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 Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
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.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE