aahmed Posted August 11, 2003 Posted August 11, 2003 Greetings, I have used the following code to get a remote machine's IP Address: dim pc as string dim hostaddress as ipaddress pc = pcname.text hostaddress = Dns.Resolve(pc).AddressList(0) Now I want to convert this IP Address to String, how could I do that? I'm relatively new to this so any help would be appreciated. Thanks. Quote
*Experts* mutant Posted August 11, 2003 *Experts* Posted August 11, 2003 To convert objects to string use the Convert class: Dim stringip as String = Convert.ToString(Long value here) Quote
BrianHansen Posted August 12, 2003 Posted August 12, 2003 or hostaddress.ToString(); Works in c#, not sure about vb.net though. Quote
aahmed Posted August 12, 2003 Author Posted August 12, 2003 Thanks Mutant, that did it, I really appreciate it. Quote
ThePentiumGuy Posted February 12, 2005 Posted February 12, 2005 How about the other way around? String ("127.0.0.1") -> Long. Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
kcwallace Posted February 23, 2005 Posted February 23, 2005 What do I need to reference to use the code below? dim pc as string Dim hostaddress As ipaddress pc = pcname.text hostaddress = Dns.Resolve(pc).AddressList(0) Quote Go Beavs!!!
Administrators PlausiblyDamp Posted February 23, 2005 Administrators Posted February 23, 2005 At the top of the code module add Imports System.Net nd things should be good Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
kcwallace Posted February 23, 2005 Posted February 23, 2005 Thank you for the reply. Quote Go Beavs!!!
Diesel Posted February 24, 2005 Posted February 24, 2005 PentiumGuy, to convert a string to an Ip, use System.Net.IPAddress.Parse() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.