|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Thank you in advance for any and all comments and help.
I have an application that an Administrator might use. I'm trying to figure out how to programatically get the local Machine LAN IP addres. Using VB.NET 2005. -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. Net.Dns.GetHostByName(Net.Dns.GetHostName).AddressList.GetValue(0)
that will return an IPAddress object of the local computer in terms of the LAN IPAdress of the computer -- -iwdu15 Thank you for a quick reply, but when I attempt to use the code you supplied
I get all kinds of errors saying sytax is obsolete and use xxxxx etc -- Show quoteHide quoteMichael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. "iwdu15" wrote: > Net.Dns.GetHostByName(Net.Dns.GetHostName).AddressList.GetValue(0) > > that will return an IPAddress object of the local computer in terms of the > LAN IPAdress of the computer > > -- > -iwdu15
Show quote
Hide quote
"eSolTec, Inc. 501(c)(3)" <esoltec@noemail.nospam> wrote in message Use GetHostEntry:news:89C3AC5E-4223-494F-9753-8C39C1DD4D6C@microsoft.com... > Thank you for a quick reply, but when I attempt to use the code you > supplied > I get all kinds of errors saying sytax is obsolete and use xxxxx etc > -- > Michael Bragg, President > eSolTec, Inc. > a 501(C)(3) organization > MS Authorized MAR > looking for used laptops for developmentally disabled. > > > "iwdu15" wrote: > >> Net.Dns.GetHostByName(Net.Dns.GetHostName).AddressList.GetValue(0) >> >> that will return an IPAddress object of the local computer in terms of >> the >> LAN IPAdress of the computer Net.Dns.GetHostEntry(Net.Dns.GetHostName).AddressList.GetValue(0).ToString Cheers, Greg for VB 2005 its
Net.DNS.GetHostEntry(Net.Dns.GetHostName()).AddressList.GetValue(0) that should work -- -iwdu15 iwdu15,
I was able to find a post by your and get the code. in .NET 2005, some API's have changed and the code you gave me did not work, but I did get if figured out. Thank you for the heads up. Now I'm trying to find a way to get the router IP address programatically. :) Dim HostIP As IPAddress HostIP = Dns.GetHostEntry(Dns.GetHostName).AddressList.GetValue(0) Label1.Text = HostIP.ToString the change was subtle but notice the GetHostEntry! -- Show quoteHide quoteMichael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. "iwdu15" wrote: > for VB 2005 its > > Net.DNS.GetHostEntry(Net.Dns.GetHostName()).AddressList.GetValue(0) > > that should work > -- > -iwdu15 By you, not your. I'm really tired :) Thank you again.
-- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. hello Michael,
Are you using VB 2005 when testing the code? Also, what's the detailed syntax error and which method is the compiler recommending you to use? Here are the two code fragment that works correct in my VB 2005 console application: =============== For Each ip As System.Net.IPAddress In System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()) Console.WriteLine( ip.ToString()) Next For Each ip As System.Net.IPAddress In System.Net.Dns.GetHostEntry(Net.Dns.GetHostName()).AddressList Console.WriteLine(ip.ToString()) Next ======================= Hope this helps. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. Steven,
Thank you for your reply. I was able to find the answer in a previous post to correct the API change in .NET 2.0. -- Show quoteHide quoteMichael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. "Steven Cheng[MSFT]" wrote: > hello Michael, > > Are you using VB 2005 when testing the code? Also, what's the detailed > syntax error and which method is the compiler recommending you to use? > > Here are the two code fragment that works correct in my VB 2005 console > application: > > =============== > For Each ip As System.Net.IPAddress In > System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()) > > Console.WriteLine( ip.ToString()) > Next > > > > For Each ip As System.Net.IPAddress In > System.Net.Dns.GetHostEntry(Net.Dns.GetHostName()).AddressList > Console.WriteLine(ip.ToString()) > Next > ======================= > > Hope this helps. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > > This posting is provided "AS IS" with no warranties, and confers no rights. > >
Visual Basic beginner question
Search for files in folders? Date/Time Pickers/VB2005 app.config not copied to bin directory VB2005: Error Using a Separate Search Form How can I execute a simple command? String quickie: Remove trailing space from each RichTextBox line? how to open a form in C# Download tif from the web via a stream with progress indication Repeated Warning: "There are Updated Custom Wrappers Available..." |
|||||||||||||||||||||||