Geeks With Blogs

News INETA Community Speakers Program WTFNext's hosting!

View Stacy Vicknair's profile on LinkedIn

WTF Next? Dev ramblings from a master of nothing.

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)

And you'll see this when you run it:


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


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


Technorati Tags: ,
Posted on Thursday, November 13, 2008 4:25 PM VB .NET | Back to top

Comments on this post: .NET Tip: Must initialize My.User before use in console based applications

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Stacy Vicknair | Powered by: