Computing.Net > Forums > Programming > HELP! Running CMD command in VB

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

HELP! Running CMD command in VB

Reply to Message Icon

Name: Eprouvez
Date: May 2, 2008 at 00:42:29 Pacific
OS: XP PRO
CPU/Ram: 768
Product: 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.

Can anyone help me?
Thanks!




Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: May 2, 2008 at 01:55:09 Pacific
Reply:

I donno, it sounds like homework. Especially since you never specified which VB.


0

Response Number 2
Name: Eprouvez
Date: May 2, 2008 at 14:49:23 Pacific
Reply:

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.


0

Response Number 3
Name: Razor2.3
Date: May 2, 2008 at 16:48:30 Pacific
Reply:

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.


0

Response Number 4
Name: Eprouvez
Date: May 2, 2008 at 21:55:24 Pacific
Reply:

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 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

End Sub
End Class


0

Response Number 5
Name: Razor2.3
Date: May 2, 2008 at 22:55:48 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: Eprouvez
Date: May 4, 2008 at 02:02:25 Pacific
Reply:

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.


0

Response Number 7
Name: Razor2.3
Date: May 4, 2008 at 11:02:04 Pacific
Reply:

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.


0

Response Number 8
Name: Eprouvez
Date: May 6, 2008 at 01:56:54 Pacific
Reply:

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!


0

Response Number 9
Name: Eprouvez
Date: May 9, 2008 at 22:01:23 Pacific
Reply:

The link to my IP Address Finder.

http://myfreefilehosting.com/f/3328...


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: HELP! Running CMD command in VB

run dos command in vb www.computing.net/answers/programming/run-dos-command-in-vb/121.html

Update command in VB.NET www.computing.net/answers/programming/update-command-in-vbnet/3989.html

HOW CAN I RUN UNIX COMMANDS in VB6? www.computing.net/answers/programming/how-can-i-run-unix-commands-in-vb6/14264.html