How to know current user name?

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

In my application I have a file with some information initialized to the
author's name.
I would like to pick it up automatically!
How do I do that?

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
 
Mhh.... almost there...
I found that:
System.Security.Principal.WindowsIdentity.GetCurrent().Name

But the problem is, it returns that:
PC1\Lloyd Dupont

Is there a solution without the "Computer\" prefix?
 
In my application I have a file with some information initialized to the
author's name.
I would like to pick it up automatically!
How do I do that?

Systen.Environment.UserName


Mattias
 
Mhh.... almost there...
I found that:
System.Security.Principal.WindowsIdentity.GetCurrent().Name

But the problem is, it returns that:
PC1\Lloyd Dupont

Is there a solution without the "Computer\" prefix?

How about Environment.UserName ?

Marc
================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
 
¤ Mhh.... almost there...
¤ I found that:
¤ System.Security.Principal.WindowsIdentity.GetCurrent().Name
¤
¤ But the problem is, it returns that:
¤ PC1\Lloyd Dupont
¤
¤ Is there a solution without the "Computer\" prefix?

If you want both it's easy enough to split:

MsgBox(System.Security.Principal.WindowsIdentity.GetCurrent.Name.Split("\"c)(1))
MsgBox(System.Security.Principal.WindowsIdentity.GetCurrent.Name.Split("\"c)(0))


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top