omid talebi

How can I retrive MachineName


Re: Visual C# General How can I retrive MachineName ?

boban.s

Environment.MachineName

Have a look at Environment class and know what information can be used from this static class.






Re: Visual C# General How can I retrive MachineName ?

In Love With Dotnet

Its very simple my friend. No need to include any special namespace. Assuming you created textbox control with default name :

textBox1.Text = Environment.MachineName.ToString();

For further evnironment information, go to http://msdn2.microsoft.com/en-us/library/system.environment.aspx

Thats it! Smile






Re: Visual C# General How can I retrive MachineName ?

boban.s

In Love With Dotnet wrote:

Its very simple my friend. No need to include any special namespace. Assuming you created textbox control with default name :


No, you need to add System namespace.

In Love With Dotnet wrote:

textBox1.Text = Environment.MachineName.ToString();


MachineName is of string type so ToString() is not necessary.






Re: Visual C# General How can I retrive MachineName ?

In Love With Dotnet

Hi Boban,

By Special namespace I meant other than default. I agree with your observation of ToString. Smile






Re: Visual C# General How can I retrive MachineName ?

vinoth kumar.R

Environment.MachineName.ToString();