I would like to know how i can change my IP setting through
my vb app.
Can some body help me with that?
Printable View
I would like to know how i can change my IP setting through
my vb app.
Can some body help me with that?
Could you be a bit more specific? You want to change the actual IP address, if I read you correctly. Do you use DHCP or a static IP address? Do you have a permanant connection to the Internet or are you using a dialup with a modem? All of these are important to know for help :)
Well i use a static IP, for my network card.
Let say my setting are
1.
IP Address : 200.150.174.28
Subnet Mask : 255.255.255.192
Gateway : 200.150.174.2
but i also have to frequently change my IP address to
1.
IP Address : 200.150.174.70
Subnet Mask : 255.255.255.192
Gateway : 200.150.174.120
3.
IP Address : 200.150.150.28
Subnet Mask : 255.255.255.192
Gateway : 200.150.150.2
4.
IP Address : 200.150.150.70
Subnet Mask : 255.255.255.192
Gateway : 200.150.174.120
Internet is not an issue since it goes through the gateway.
So i just need to know if it's possible to change my network
setting of my ethernet card via my application.
I suppose that changing the DNS would be the same as change
the IP address and so...
Thanks.
I'd assume the same thing about being able to change the DNS info the same way as the IP, but...
As far as I know, there's no way to change the IP via VB, or in fact any way besides the Network Properties screen. Sorry :(
Ok maybe you can help me with that.
If i go directly to registry i know that the network setting, are stored in
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\
in fact in my laptop it's stored in
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0003
but some time it's stored in ...\0002 or ...\0001 so how can i get
the information from the registry and the save it back to it.
I don't care if i have to reboot my pc after.
But i don't know a thing about registry through code.
Can you help me with that?
On www.vbworld.com there is a tutorial on working with the registry in VB code, that'll allow you to read + write values to the registry :)
Couple of points though:
1. I'm going to go out on a limb and guess that your computer(s) are Win95, 98, or ME systems. The information in the key you posted here is stored in a different place under WinNT and Win2000 (such as my computer is), so if you're writing your code to be portable or eventually distributable you should be aware of that.
2. As far as the "0001" "0002" and so on entries under the key: Those correspond to the different installed adapters on the system. Interestingly enough, if an adapter is uninstalled and a new one put in, Windows doesn't reuse the numbers, it'll just keep counting up! The way to know which of these is the one you want: If your connection is named "Local Area Connection 2", the info is under "0002" :)
Actually, just looking up the info under my own computer (which is admittedly different being Win2K and using DHCP), I'm not finding anything relating to IP addresses, even under what passes for the NetTrans key (which is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E975-E325-11CE-BFC1-08002BE10318} if you wondered!). Could you post the info you have under the key you listed?
Here is what i have under this key and what they are related to as header
Fast Infrared Protocol -> SMC IrCC (Infrared Communication Contoler)
[HKEY_LOCAL_MACHINE\...\NetTrans\0000]
"DriverDesc"="Fast Infrared Protocol"
"InfSection"="FASTIR.ndi"
"InfPath"="FASTIR.INF"
"ProviderName"="Microsoft"
"DevLoader"="*ndis"
"DeviceVxDs"="fastir.vxd"
"DriverDate"=" 5- 5-1999"
TCP/IP -> Carte d'acces a distance "Modem"
[HKEY_LOCAL_MACHINE\...\NetTrans\0001]
"DriverDesc"="TCP/IP"
"InfSection"="MSTCP.ndi"
"IPAddress"="0.0.0.0"
"IPMask"="0.0.0.0"
"DeviceVxDs"="vtdi.386,vip.386,vtcp.386,vdhcp.386,vnbt.386"
"InstallVnbt"="0"
"InfPath"="NETTRANS.INF"
"ProviderName"="Microsoft"
"DriverDate"=" 5- 5-1999"
"DevLoader"="*ndis"
TCP/IP -> Xircom CardBus Ethernet II 10/100
[HKEY_LOCAL_MACHINE\...\NetTrans\0003]
"DriverDesc"="TCP/IP"
"InfSection"="MSTCP.ndi"
"IPAddress"="200.150.174.28"
"IPMask"="255.255.255.192"
"DeviceVxDs"="vtdi.386,vip.386,vtcp.386,vdhcp.386,vnbt.386"
"InstallVnbt"="0"
"InfPath"="NETTRANS.INF"
"ProviderName"="Microsoft"
"DriverDate"=" 5- 5-1999"
"DevLoader"="*ndis"
"NodeType"="1"
"DefaultGateway"="200.150.174.2"
I'm gonna check on the registry and i'm gonna get back to you
about that thanks a lot.