Interacting with .NET WinForms, Part 2 DC

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

APB News Com
(202) 204-3045
1300 Pennsylvania Ave
Washington, DC
Apple Computer
(202) 772-9500
901 15th St Nw
Washington, DC
Dupont Computers Inc
(202) 232-6363
1761 S St NW
Washington, DC
Rent-A-PC
(202) 582-0900
Washington, DC
IBM Corp 800 426-3333
(202) 515-4000
1301 W K St
Washington, DC
Best Buy
(202) 895-1580
4500 Wisconsin Ave Nw Ste 3
Washington, DC
Computers Made Easy Inc
360-843-4083
7700 NE Greenwood Dr Ste 240Vancouver,
Washington, DC
APTI
(202) 223-8808
1250 24th St Nw
Washington, DC
USA Discounters
(202) 399-1870
1505 Maryland Ave NE
Washington, DC
Computer Accessories Store
(202) 628-4940
1522 K St NW
Washington, DC

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

Featured Local Company

Best Buy

(202) 895-1580
4500 Wisconsin Ave Nw Ste 3
Washington, DC
http://www.bestbuy.com

Related Articles
- Encrypting a File Using .NET DC
Our "Tacit Records" columnist shows you how .NET's cryptographic support works using the Cryptostream class, which you can implement within either C# or Visual Basic. Here's how to get started.
- An Active Server Pages Tutorial, Part 2 DC
- Devexpress ASPxGridView DC
- Creating a Rounded Panel Control DC
- An Active Server Pages Tutorial, Part 1 DC
- C# Tips and Tricks DC
- PostgreSQL Ends the Waiting Game DC
- Interacting with .NET WinForms, Part 1 DC

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