i am new to C# and i am having some issues. I have a button, 2 texstboxes (1 for hostname, other for results) I can get the below code to work and output to the Console, but I cannot get it to output to the txtnslookup textbox. No matter what I change. I'm a VB programmer, but want to start on C#. help..
Code:
private void btnNSLookup_Click(object sender, EventArgs e)
{
// Do a few lookups by host name and address
DNSLookup(txthostname.Text);
}
protected static void DNSLookup(string hostNameOrAddress)
{
Console.WriteLine("Lookup: {0}\n", hostNameOrAddress);
IPHostEntry hostEntry = Dns.GetHostEntry(hostNameOrAddress);
Console.WriteLine(" Host Name: {0}", hostEntry.HostName);
IPAddress[] ips = hostEntry.AddressList;
foreach (IPAddress ip in ips)
{
Console.WriteLine(" Address: {0}", ip);
}
Console.WriteLine();
}
}
}