I was fooling around with the Label control in Visual Studio and I wanted the next few words to be on the 2nd line of the Label control. \n is a newline character and I expected that adding that one to the Label’s Text property, the newline would take effect. Turns out the slash and n appears as is if you do it in Visual Studio’s property box. To have a newline working in a Label Control, you would have to do it programatically. Then your \n will work.

This may hold true with other controls. If your newline character will not work when you add it within Visual Studio’s property box, try adding it programatically. I am sure it will work.

MessageBox in C# is supposed to be modal. At least that was what I expected. However, upon using it, it does not center itself against the parent container. Rather, it positions itself at the center of the screen. So if your parent container would be moved to the lower right, the MessageBox will still appear at the center no matter what. Luckily, somebody from CodeProject saved us the trouble of having to create a custom class to make this work. His custom class wraps the MessageBox class into a new class name called MsgBox but with the same constructors and usage.

Pretty nifty. Since this saved me time and trouble of having to create one for myself . You can check the article here.

When you create an application, it makes more sense to keep your images in your library as resources so that they also get packaged when you decide to go to production with your application. Loading an image resource (image file that was imported from the file system to your project and can be found under the Resources tree item) can be done using Properties.Resources.?

The ? would be the name of the resource image that is part of your resources. Visual Studio’s intellisense can easily show you the list of resources once you type Properties.Resources. .

Related Posts Plugin for WordPress, Blogger...