C#: Center MessageBox

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.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

Casino Reviews

Casino Reviews has been running since 1998, an obvious hint that this site has served thousands of players, young and old, newbie and experienced for guides and reviews in their online casino needs. Reviews also include real land based casinos that you find in Las Vegas or in the Atlantic. Reviews were done in detail from rating their table games, to slots, to payout services, software and its graphics, bonuses and even support. If you are a registered user, you can also write a review on your experiences and/or what your opinions are with the online casino involved. Or just view user rated reviews made by other people.

Casino games come in different shapes and game play and Casino Reviews provides guides and strategies for beginners and experienced players alike to help them the basics on to the advanced tips to aid them in upping their winnings. From the most common like Slots, Videpoker and Roulette to other games like Keno, Craps, Bacarrat and Bingo, the site’s vast archive of contents will help you what you need to know playing in online casinos and their games. This site definitely has loads and loads of information to offer. Go check it out.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

C# Load An Image Resource

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. .

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

C#: Using ListBoxes

ListBoxes are those same drop down components that you see in HTML forms. The same control called ComboBox works the same way although the appearance would be that of a 1 liner drop down box. Anyway, adding items to a ListBox object is pretty easy. Just do

MyListBox.Items.Add("Item 1");
MyListBox.Items.Add("Item 2");

But the code above will only add the labels that will apear within the ListBox. What if you want to have a ListBox that acts the same as a drop down HTML form component with a name and value attribute. You can create your own custom class with Name and Value exposed, place them inside an ArrayList object and pass it on to the ListBox’s DataSource property.

public class ListBoxItem {
 
	public String Name;
	public String Value;
 
	public ListBoxItem(String name, String value) {
		Name = name;
		Value = value;
	}
 
	public override String toString() {
		return Name;
	}
 
}
 
ArrayList al = new ArrayList();
al.Add(new ListBoxItem("Item 1", "Value1");
al.Add(new ListBoxItem("Item 2", "Value2");
 
MyListBox.DataSource = al;

You can then get the selected name (and/or value) of the ListBox by doing this

((ListBoxItem) MyListBox.SelectedItem).Name

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...