Wednesday 3 April 2013

RichTextBox ,MessageBox and Masked TextBox Control

RichTextBox control is similr to a text box but provides advanced text entry and editing features like paragragh formatting. This control provides a set of properties and methods to perform formatting of the text.

Properties
Font, BackColor, ForeColor, Wordwrap, modified
Methods
 Cut(), Copy(), Paste(),Undo(), Redo(), SelectAll(), DeselectAll()
SaveFile(String fname, RichTextBoxStream Type t)
LoadFile(String fname,RichTextBox Straem Type t)

RichTextBox Stream Type is an enum which provides with a list of formats in which we want to save the file like plain Text(for notepad), RichText(for wordpad), etc
MessageBox Control

This control is use for diplaying message within a Windows application to the end user. The type of message being displayed can be euther an alert or warning or error or information messages etc.

To display the message in messagebox we can use overloaded method show which returns value of type dialog result which tells which button has been clicked on the messagebox.

show(string msg)    
show(string msg, string title, MessageBoxButtons)
show(string msg,string title, MessageBoxButtons buttons,MessageBox icon icon)

MessageBox
buttons is an enum which will list a set of constants to  choose like what type of icon image has to be displayed on the messagebox.


Masked TextBox
 This control is an extension to text box which is provided for distinguishing between proper and improper input i.e we can take the input from the user in specified format like date, time and PNR number etc. To set the format in which the input has to be entered we are provided with property masked.  Once we select the property in property window we will find a button inside it click on it which opens a  window displaying a list of predefined formats to choose, we can either select a required format for it or choose custom and enter the input format within the masked textbox  below using zeroes.

For Example:
Railway PNR No: 000-0000000
Date                   : 00/00/00
Time                   : 00:00:00

No comments:

Post a Comment