Browse by Tags

All Tags » WinForms » C# » VB (RSS)
The startup form is the first form that is launched when your application is executed. By default, a Windows Forms project creates a default form when the project is created. This form is set as the startup form. You can change the startup form to any...
2 comment(s)
Filed under: , , , , ,
This prior post demonstrated how to use delegates to associated code with a Tag in a WinForms control. This post shows how to accomplish the same thing using Lambda expressions to define the delegate. To try out this example, create a WinForms application...
Many of the Windows Forms controls have a Tag property that you can use to store data associated with the control. For example, TextBoxes have a Tag property so you could store additional information about each TextBox in the Tag. For TreeView controls...
When working with data, you often have values that are null. For example, you may allow entry of a user's birthday, but not require entry. So some of your rows may contain a null date. Or your application may track a customer's last order date...
A common question on the forums is how to use the Enter key instead of the Tab key to move through the controls on a Windows form. One common approach is to use SendKeys to send a Tab. But here is another option. NOTE: To use this technique, set the KeyPreview...
with no comments
Filed under: , , , ,
There are endless numbers of details you have to contend with when building great software. So it is easy to forget about some of the small ones, especially when it comes to the UI. So I use a checklist like this one to help ensure I covered all of my...
3 comment(s)
Filed under: , , , ,
Sometimes you want to add a little color to your WinForms controls. WinForms comes with a large set of named colors that you can use. NOTE: Be sure to import a reference to System.Drawing . For example In C#: textBox1.BackColor = Color.Linen; In VB: textBox1...
2 comment(s)
Filed under: , , , ,
This post details first how to build a list containing the data to display in a WinForms TreeView control. Then it demonstrates how to use recursion to populate the TreeView control from the list. [For information on populating a TreeView control from...
12 comment(s)
Filed under: , , , ,
If you are building a WinForms application and want to style your text, you may want to use the RichTextBox control instead of the standard TextBox control. This post provides some of the common techniques required to style text in a RichTextBox control...
8 comment(s)
Filed under: , , , ,
If you are using XML in a WinForms application you may find the need to display the XML data in a DataGridView. Let's take this XML: <states>     <state name="California">        ...
The same several questions often come up in the forums regarding the basics of building a user control with VB.NET or C#. The goal of this post is to answer those questions. There are three basic types of WinForms user controls that you can create: Extended...
5 comment(s)
Filed under: , , , ,
Though this is not necessarily a common requirement, this post demonstrates the following techniques. Converting a text string to an array. Passing data from one form to another on a constructor. Picking a unique set of random numbers. Using the set of...
1 comment(s)
Filed under: , , ,
It is often necessary for one form in your WinForms application to pass information to another form in your application. Though there are multiple ways to pass the data, this post focuses on using a form constructor. Take a simple case, on Form1 there...
8 comment(s)
Filed under: , , , ,
As stated here , you use object binding in a WinForms application by following these steps: 1. Build the business objects for your application. 2. Define a business object data source in the Windows Application project containing your user interface....
As stated here , you use object binding in a WinForms application by following these steps: 1. Build the business objects for your application. 2. Define a business object data source in the Windows Application project containing your user interface....
If you have a data in a Windows Forms DataGridView, you may want to use some color to highlight specific rows of the grid to draw in the user’s attention. In this example, the code paints a border around a specific row and sets the background color. In...
11 comment(s)
Filed under: , , , ,
There are often times that you need to find specific controls on a Windows Form (WinForm). For example, you may want to find all of the TextBoxes to clear their contents, set their background color, or hook up events. You may want to find all of the checkboxes...
18 comment(s)
Filed under: , , , ,
There are many things in VB.NET and C# that are very similar. So if you know that basic syntax of both languages, it is relatively easy to convert a few lines of code from one to the other. Not so much with events. This is one area where it is easy to...
4 comment(s)
Filed under: , , , ,
This post describes how to populate a WinForms TreeView control from an XML file assuming you are targeting the .NET Framework Version 3.5. The XML file used in this example looks like this: <States>   <State name="California">...
12 comment(s)
Filed under: , , , , ,
My prior post demonstrated how to bind to a list of month names. Once the user picks the desired month, you may want to provide a list of valid dates to pick a date in that month. For example: 1-30 for September and 1-31 for July. You can accomplish this...
More Posts Next page »