How to get a PC name to your C# application


Step 01 : Open Visual Studio 2008 and start WindowsFormApplication




Step 02 : Design following Form


Step 03 : Double click on the Form and add following code segment in side the form load event



Step 04 : Then run the ( press F5 )

Thank you all

Categories:

One Response so far.

  1. Unknown says:

    private void Form1_Load(object sender, EventArgs e)
    {

    string sysname = System.Environment.MachineName;
    string username = System.Environment.UserName;
    label2.Text = sysname +"/"+ username;
    }

Leave a Reply