Shoutbox

VB and Network cards' IP - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB and Network cards' IP (/showthread.php?tid=71363)

VB and Network cards' IP by ryxdp on 02-04-2007 at 05:23 AM

I work with Visual Basic 2005 Express Edition, and I've been wondering, is there is a way to return the Network Card's IP address? Example:

TextBox1.Text = ([line of code for net card's IP])

So that it shows my card's IP: 192.168.1.8

And also can you find out the strength of a wireless signal (I have a Netgear WG311T) using VB, or do you need some sort of external .exe?

I don't know a whole heap on Visual Basic, so maybe I missed something.:S

Any help is much appreciated:)


RE: VB and Network cards' IP by davidpolitis on 02-04-2007 at 08:48 AM

Steps:

1. Create a new project with the startup form name "Form1"

2. Add a Textbox name "Textbox1"

3. Replace all of the code with the below code.

-----------------------------------------------------------------------------------------------------

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList(0).ToString()
    End Sub
End Class

-----------------------------------------------------------------------------------------------------



Hope this helped :P


RE: VB and Network cards' IP by ryxdp on 02-04-2007 at 10:35 AM

Thanks, it worked :P


RE: VB and Network cards' IP by davidpolitis on 02-04-2007 at 10:36 AM

Cool. Took me ages to find that, but I wanted to know how to do it anyway :P

Also, I'm sorry to say this but... the thing that you want to do with the wireless connection is basicaly impossible unless you get some SUPER coder to code it for you :'(


RE: VB and Network cards' IP by CookieRevised on 02-04-2007 at 03:59 PM

quote:
Originally posted by Ryxpia
And also can you find out the strength of a wireless signal (I have a Netgear WG311T) using VB, or do you need some sort of external .exe?
It is very easy to do this using WMI and NDIS...

http://msdn2.microsoft.com/en-us/library/ms895622.aspx
http://msdn2.microsoft.com/en-us/library/ms901469.aspx

Also, google is your friend (as always), so search first (with the proper logic keywords):
http://www.google.be/search?q=VB+wifi+signal+strength

Example code can be found in many places, eg like:
http://www.planet-source-code.com/vb/scripts/Show...eId=2234&lngWId=10


------

PS: VB (both 6 and .NET) can do virtually anything any other exe can do, you don't need external exe's for anything, as long as you know how it is coded of course; a good example is (un)zipping which can be done perfectly within VB provided you know how ZIPs work and are (un)packed).
RE: VB and Network cards' IP by ryxdp on 02-05-2007 at 05:53 AM

Thanks(Y)

The Planet Source Code one works great, but I'd like to make the signal indicators the same sort of style as the network connections thing in the Control panel (see attachment).

As I said, I don't know a lot about VB, so thanks in advance :P

EDIT: I've nabbed the strength indicators from xpsp2res.dll in /system32/mui/0401 using ResHacker, how do I set them as the indicator, eg. something along the lines of:

vbnet code:
If dbl_strength = 0 Then
PictureBox1 = My.Resources.Signal_pic0
End If

If dbl_strength = 1 Then
PictureBox1 = My.Resources.Signal_pic1
End If
And so on...

(They are .icos, I will convert them to .pngs and hope PictureBoxes support .png transparency :S)