JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Chapter 5: Windows Forms: Text Boxes, Rich Text Boxes, Labels, and Link Labels


Main Page

    The Control Class
    Text Boxes
    Rich Text Boxes
    Labels
    Link Labels
    Immediate Solutions: Setting the Mouse Pointer in Controls
    Text Boxes
    Creating Multiline, Word-wrap Text Boxes
    Accessing Text in a Text Box
    Adding Scroll Bars to Text Boxes
    Aligning Text in Text Boxes
    Making a Text Box Read-only
    Selecting and Replacing Text in a Text Box
    Copying or Getting Selected Text to or from the Clipboard
    Creating a Password Control
    Controlling Input in a Text Box
    Creating a Text Box in Code
    Rich Text Boxes
    Accessing Text in a Rich Text Box
    Creating Bold, Italic, Underlined, and Strikeout Text
    Indenting Text in Rich Text Boxes
    Adding Bullets to Rich Text Boxes
    Setting Text Color in RTF Boxes
    Saving and Loading RTF Files from and to Rich Text Boxes
    Aligning Text in a Rich Text Box
    Creating Rich Text Boxes in Code
    Labels
    Using Labels Instead of Text Boxes
    Formatting Text in Labels
    Aligning Text in Labels
    Handling Label Events
    Using Labels to Give Access Keys to Controls without Captions
    Link Labels
    Creating a LinkLabel
    Creating a LinkLabel in Code
    Linking to Another Form
    Linking to the Web

In Depth

This chapter starts our in-depth look at Windows forms controls. We'll begin with text boxes, rich text boxes, labels, and link labels; you can see these controls in Figure 5.1. All these controls are used to handle text. Text boxes and rich text boxes let the user enter text, labels and link labels display text, rich text boxes let you format text, and link labels let you support hyperlinks. These controls get a lot of use in Visual Basic programs, so there's a great deal of programming power coming up in this chapter.


Figure 5.1: A text box, a rich text box, a label, and a link label.

Like all the Windows controls we'll be looking at in this and the next several chapters, these controls are based on the Control class. The many controls derived from this class inherit a lot of functionality from it, so their common base class, the Control class, is the first thing I'll take a look at here, providing us with a good foundation for this and the chapters to come.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor