WTF Next?

Dev ramblings from a master of nothing.

  Home  |   Contact  |   Syndication    |   Login
  130 Posts | 0 Stories | 77 Comments | 0 Trackbacks

News

INETA Community Speakers Program
GeeksWithBlogs.net: WTFNext's hosting!

View Stacy Vicknair's profile on LinkedIn

Twitter







Tag Cloud


Archives

Post Categories

Community Links

User Groups

If you make use of the My.User object in a WinForms application, you can just dive right into it and start using it right away, however, if you add this to a new console app it returns a blank response for My.User.Name:

Console.WriteLine("User: {0}", My.User.Name)
Console.ReadLine()

And you'll see this when you run it:

image

To get around this problem, all it takes is an initialization that gets called automagically in WinForms:

My.User.InitializeWithWindowsUser()

Put that before you use the object for the first time and you'll be good to go!

image

Technorati Tags: ,
posted on Thursday, November 13, 2008 4:25 PM