Interacting with .NET WinForms, Part 2 West Virginia

We conclude our tutorial on working with Windows Forms in Microsoft.NET. Here, we'll examine some of the important GUI Controls and their application in C#.

Local Companies

IBM Corp
(304) 347-7300
150 Laidley St
Charleston, WV
Computers 4 U Inc
(304) 675-5282
303 Main St
Point Pleasant, WV
Blue Line Computers Llc
(304) 242-0032
1062 E Bethlehem Blvd
Wheeling, WV
Harvey Computer Service Inc
(304) 845-1862
63 Linden Ave
Moundsville, WV
Groupstar.Com
(304) 243-9811
41 11th St
Wheeling, WV
Stenger Business Systems
(304) 233-2666
1035 Chapline St
Wheeling, WV
Wholesale Computers
(304) 748-0273
3129 Main St
Weirton, WV
Technology Services Group Inc
(304) 232-5427
48 14th St Ste 301
Wheeling, WV
Future Tech Inc
(304) 425-2709
105 S Walker St
Princeton, WV
Computerland
(304) 232-5427
48 14th St Ste 301
Wheeling, WV

provided by: 
Originally published at Internet.com


We use a lot of controls like Buttons, Label, Checkbox, Radio Button, Text boxes, etc. while developing a GUI application. .NET provides a wide range of class, properties, and events for developing a complete GUI program by using the Control class of System.Windows.Forms namespace. In this part of our tutorial, I'll examine some of the important GUI Controls and their application in C#.

General Method for Adding Controls to Forms



1. Create an instance of the control. 2. Apply necessary properties like location, size, width, height, etc. 3. Finally, add the Control object to the Form's Controls Collection.

Using TextBox



Generally, Text boxes are of two classes, viz., Single line and multiple line boxes. Multiple line boxes have scroll bars. Also, users can enter more lines of text in them. The superclass of TextBox Control is TextBoxBase. It also provides functionalities for advanced controls like RichTextBoxes.

The following listing shows the usage of TextBox by examining important properties. Keep in mind that some of the properties derive from the TextBoxBase class. TextBox class provides only a limited set of properties. Listing 1.

using System; using System.Windows.Forms; using System.Drawing; public class Text: Form { // Text box object created TextBox t1 = new TextBox(); Text() { // Text box added this.Controls.Add(t1); t1.Location = new Point(50,50); t1.Size = new Size(200,50); t1.Text = "Class something to test"; t1.Multiline = true; t1.ScrollBars = ScrollBars.Vertical; t1.TextAlign = HorizontalAlignment.Center; t1.CharacterCasing = CharacterCasing.Upper; } public static void Main() { Application.Run(new Text()); } } ...

Read article at Internet.com site

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML