Saturday, November 28, 2009

Windows user name in C#

Problem:
How do I get the Windows user name in a C# application?

Solution:
It's located in Environment.UserName, this will show you a dialog box with your Windows user name.
MessageBox.Show(Environment.UserName);

No comments:

Post a Comment