How to get DNS host name of local computer in C#

1 Answer

0 votes
using System.Net;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string MyHostName = Dns.GetHostName();

            label1.Text = MyHostName;
        }
    }
}




/*
 * run:
 *
 * PQM-X7BZ9W"
 * 
 */


 



answered Aug 12, 2023 by avibootz

Related questions

1 answer 175 views
1 answer 151 views
1 answer 323 views
1 answer 248 views
248 views asked Apr 8, 2014 by avibootz
1 answer 257 views
...