Lecture 4 VB Net Rich Text Box Control

Lecture 4 VB. Net

Rich Text Box Control Rich. Text. Box is a control that is able to display and edit rich-text content including formatted text arranged in pages, paragraphs, etc. It allows you to edit text and apply rich formatting options Selection. Indent property is used to set the indent for the selected text.

Rich Text Box Tool Load data from file to Rich text box Rich. Text. Box 1. Load. File("d: work. txt", Rich. Text. Box. Stream. Type. Plain. Text) Rich. Text. Box 1. Load. File("d: work. doc", Rich. Text. Box. Stream. Type. Rich. Text) Save data to file from Rich text box Rich. Text. Box 1. Save. File("d: work. txt", Rich. Text. Box. Stream. Type. Plain. Text) Rich. Text. Box 1. Save. File("d: work. RTF", Rich. Text. Box. Stream. Type. Rich. Text) Rich. Text. Box 1. Save. File("d: work. doc", Rich. Text. Box. Stream. Type. Rich. Text) Rich. Text. Box 1. Save. File("d: work. xls", Rich. Text. Box. Stream. Type. Text. Ole. Objs) Rich. Text. Box 1. Save. File("d: work. ppt", Rich. Text. Box. Stream. Type. Text. Ole. Objs)

Rich Text Box Tool Save formatting of the selected text ▪ Rich. Text. Box 1. Selection. Color = Color. Blue ▪ Rich. Text. Box 1. Selection. Back. Color = Color. Chocolate ▪ Rich. Text. Box 1. Selection. Alignment = Horizontal. Alignment. Left ▪ Rich. Text. Box 1. Selection. Indent = 5

Textbox Control Text box controls allow entering text on a form at runtime. Lines ▪ Gets or sets the lines of text in a text box control. Multiline ▪ Gets or sets a value indicating whether this is a multiline Text. Box control. Password Char ▪ Gets or sets the character used to mask characters of a password in a single-line Text. Box control.

Textbox Control Scroll. Bars Gets or sets which scroll bars should appear in a multiline Text. Box control. Values: None, Horizontal, Vertical, Both Text. Align Gets or sets how text is aligned in a Text. Box control. Values: Left, Right & Center

Textbox Control Cut Method: Moves the current selection in the text box to the Clipboard. As. Text. Box 1. Cut() Copy Method: Copies the current selection in the text box to the Clipboard. As. Text. Box 1. Copy() Paste Method: Replaces the current selection in the text box with the contents of the Clipboard. As. Text. Box 2. Paste() Reset. Text: Resets the Text property to its default value. Text. Box 2. Reset. Text() Undo: Undoes the last edit operation in the text box. As. Text. Box 2. Undo() Append. Text: Appends text to the current text of a text box. Text. Box 2. Append. Text(Text. Box 3. Text)

Tooltip Text Tooltip Control is used to display explanatory text when the mouse rest on a control or window. This control is helpful in providing a quick help to users. Set Tool. Tip Put following code in Mouse. Hover event of textbox Tool. Tip 1. Set. Tool. Tip(Text. Box 1, "Provide your comments here") Set icon Tool. Tip 1. Tool. Tip. Icon = Tool. Tip. Icon. Info Isballoon property Tool. Tip 1. Is. Balloon = True

Tree. View Control is used to display parent, child nodes in a hierarchy just as in windows explorer window that can be collapsed when clicked. Note property is used to add Root Nodes and Child Nodes. Tree. View 1. Nodes. Add(“IIT") ▪ Tree. View 1. Nodes(0). Nodes. Add("BSIT II") ▪ Tree. View 1. Nodes(0). Nodes. Add("BSIT III") ▪ Tree. View 1. Nodes(0). Nodes(2). Nodes. Add("Attendance“)

Tree. View Control Expanding and collapsing nodes Expanding particular Node ▪ Tree. View 1. Nodes(0). Expand() Expanding all nodes ▪ Tree. View 1. Expand. All() Collapsing particular Node ▪ Tree. View 1. Nodes(0). Collapse() Collapsing all nodes ▪ Tree. View 1. Collapse. All()

Tree. View Control Showing drives in Treeview Dim drives As System. IO. Drive. Info() = System. IO. Drive. Info. Get. Drives ▪ For i As Integer = 0 To drives. Length – 1 ▪ Tree. View 1. Nodes. Add(drives(i). To. String()) ▪ Combo. Box 1. Items. Add(drives(i). To. String) ▪ Next

Web Browser Control The Web Browser control in VB. NET allows you to host Web pages and other web browser enabled documents in your Windows Forms applications. It displays the web pages like normal commercial web browsers. Dock Property: Make it Fill, Top, Left, Right, Bottom to auto set the control, make none to avoid its implementation.

Web Browser Control Navigate: Property used to browse given URL E. g. ▪ Web. Browser 1. Navigate(http: //mbbscd. usindh. edu. pk) ▪ Web. Browser 1. Navigate(Textbox 1. text) Refresh: Refresh control according to given URL. E. g. Web. Browser 1. Refresh() Go Back: Property which navigate control to previous URL. E. g. Web. Browser 1. Go. Back() Go Forward: Navigate control to same url after go back. E. g. Web. Browser 1. Go. Forward()

Web Browser Control How to update textbox with change in navigation?
- Slides: 14