.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I get Computer Name using .Net

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ezcad.co.uk
677 Views, 3 Replies

How do I get Computer Name using .Net

Hi All,

I am trying to migrate from Vlisp to C# .Net & occationally struggle with simple things. Some of my Vlisp applications have an "about" command which shows a product info dialog similar to the default AutoCAD product info dialog. However, in C#, I am struggling with the code to obtain the Computer Name as a string. Would someone please mind showing an example of the required syntax to retrieve the ComputerName property from WhoHasInfo (or anywhere else for that matter) so as it can be shown in a form. See attachment which shows the existing Vlisp dialog.

Any help much appreciated as always.

AutoCAD 2009/2010 on XP Pro SP3.

Steve

3 REPLIES 3
Message 2 of 4
jeff
in reply to: ezcad.co.uk

Have you looked at the System.Environment.MachineName Property

http://msdn.microsoft.com/en-us/library/z8te35sa.aspx

 

The System.Environment class has other information pertaing to local enviroment.

 

 

        ed.WriteMessage(Environment.MachineName);
        ed.WriteMessage(Environment.UserName);
        ed.WriteMessage(Environment.CurrentDirectory);

 

 

You can also find your answers @ TheSwamp
Message 3 of 4
ezcad.co.uk
in reply to: jeff

Thanks for your prompt reply Jeff.

Presumably, (environment.machinename) returns a string which may then be assigned to a variable thus:

string compName = (environment.machinename)

Forgive me spelling things out like this but I do not have VS installed on the PC I am using at the moment.

Steve

Message 4 of 4
jeff
in reply to: ezcad.co.uk

yes sir

 

You can also find your answers @ TheSwamp

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost