* New post Constructor Destructor and Inheritance& Array , Virtual base class in c++ language

Thursday, 28 February 2013

0 TEXT BOX ,RICHTEXT BOX,LABEL,LINK LABEL

TEXT BOX ,RICH TEXT BOX ,LABEL,LINK LABEL CONTROLS IN VB.NET




  • Text box controls= The textbox controls are used to get input or to display text.The text box controls is generally used for editable text, although it can also be made for read only.Textboxes can displays multiple lines, wrap text to the size of the controls , and add basic formatiing ,such as quantation marks and masking characters for passwards.
                                                         The text property can be set at design time with the properties windows ,at run time in code ,or at runtime.
                                                We  can set  or read text from textboxes at runtime ,and you can enter and edit text in the textboxes .We can limit the amount of text entered into a textbox control by setting the max length  property to a specific number of char . by default ,the max length  value is 32767 ,if it is set to 0. Textbox controls  can also be used to accept passward if we use passward char property to mask char.

                              TEXTBOX PROPERTIES 

  • BACK COLOR= Sets the background color of the control.
  • AUTOSIZE=Sets/Gets a value specifying if the height of the control automatically adjusts ,when the font in the control is changed.
  • BORDER STYLE= Sets the border type of the textbox control.
  • CANUNDO= Return a value specifying if the user can undo the previous operation.
  • FORECOLOR= Sets the foreground color.
  • LINES=Sets the lines of text.
  • MAXLENGTH= Sets the maximum number of characters the user can type into the text box.
  • MULTILINE=Sets a value specifying if this is a multiline textbox control.
                                 TEXTBOX EVENTS
  • AUTOSIZECHANGED= Occurs when the value of a autosize property is changed.
  • CLICK= Occurs when the text box is clicked 
  • READONLYCHANGED= Occurs when the value of the readonly property has changed.
         ADDING SCROLL BARS TO TEXTBOXES

Now ,you are using multiline text boxes ,it would be even better if we could add scroll bars. Using the scrollbars property, there are four ways to add scrollbars to a textboxes ,and set the setting for scrollbars ,and the type of scrollbars each setting displays.

  • : none
  • : horizontal
  • : vertical
  • : both
SELECTING AND REPLACING TEXT IN A TEXT BOX 
  • SELECTIONLENGTH= Return or sets the number of char selected.
  • SELECTIONSTART=Return or sets the starting point of text selected.
  •  SELECTION TEXT=Return or sets the string containing the currently selected text .Consists of a zero length string ("") if number char are selected.
RICH TEXT BOX (RTB) 
 The rtb controls is used for displaying ,entering and manipulating rich text box with formatting .The rtb controls does everything the textbox controls does , but in addition ,it can display font ,color and links ;load text and embedded images from a file ; undo and redo editing operation and find specified char.
                     INDENTING TEXT IN RICH TEXT BOXES 
One of the aspects of word processors that have gotten used in the ability to indent text , richtextboxes have the capabilities.
  • SELECTION INDENT= Indents first line of paragraph .
  • SELECTIONHANGINGINDENT= Indents all other line of the paragraph with respects to selection indents.
  • SELECTIONRIGHTINDENT= Set the right indentation of the paragraph.
                                         ADDING BULLET

Rich text boxes support bullets black dots appear in lists  that we want to set off in text.To set bullets ,we use the selection bullets properties .The selection bullets properties display a bullet in front of the paragraph , the bullet indent properties indicates how much we want the bullet to be indended  
the left.

    SETTING TEXT COLOR IN RTB BOXES
To set color in rtb ,we can make a selection and set the rtb selection color property .
                                                         CODING 

                         Richtextbox1.selection color=color.red

     SAVING AND LOADING RTF FILES
we Can use the save file method to save the text in rtb to disk ,and the load file method to read its back .



                                 CODING 
Richtextbox1.savefile("parveen,rtf")
Richtextbox2.loadfile ("parveen,rtf")




                        

                RICHTEXTBOX PROPERTIES 

  • BACK COLOR= Sets the background color of the control.
  • BORDER STYLE= Sets the border type of the richtextbox control.
  • BULLET INDENT= Sets the indentification used in the richtextbox when the bullet style is applied to text.
  • CANUNDO= Return a value specifying if the user can undo the previous operation.
  • RTF            = Sets the text of the richtextbox controls including all rich text formats (rtf) codes.
  • TEXT=Sets the current text in the richtextbox.
  • TEXTLENGTH=Gets the length of text in the richtextbox controls.
  • SELECTION COLOR= Sets the text color of the current text  selection or insertion point.

                                                               LABEL

Label are used to display text that can not edited .The code can change the text displayed by a label. The caption for a label is stored in the text property .Because we can change in code,labels can act a little like,non aditable textboxes ,displayin text message.
                                     LABELS PROPERTIES


  • AUTOSIZE=Sets/Gets a value specifying if the height of the control automatically adjusts ,when the font in the control is changed.
  • BORDER STYLESets the border type of the label control. 
  • FLAT STYLE=Sets the flat style apperance  of the label controls.
  •  IMAGE=Sets the image that is displayed on a label.
  • TEXTALIGN=Sets the alignment of text in the control. 
  • IMAGE ALIGN= Sets the alignment of an image i.e dislpayed in the control. 

                               LINK LABEL

Link label are new in vb.net ,they are based on the label class ,but also let you support " web style hyperlink to the internet "    and other windows forms .you can use a link label hyperlink to the internet  and other words ,you can use a link label controls for everything that you use a label controls ,you can also make part of the text in the control link to a vb objects or web page.
                        LINK LABEL PROPERTIES 

  • ACTIVE LINK COLOR= Sets the color for an active link.
  • DISABLEDLINKCOLOR= Sets the color for an disabled link.
  • LINKAREA= Sets the range in the text to treat as a link.
  • link color= Sets the color for a normal link.
LINK LABEL EVENTS

  • LINKCLICKED= Occurs , when a link is clicked inside the linklabel.
CREATING A LINK LABEL

We can create a link label just as we would create a label , by dragging  one onto a windows form and enterying text into text property .By clicking the linkarea property in the properties windows and checking the ellipsis(".......") button that appear to open the link area editor .We can also set the link color , visitedlinkcolor, and activelinkcolor properties to set the colors of the hyperlinks.
CODING 
Private sub linklabel1_linkclicked(byval sender as system.objects , byval e as system .windows.forms.linklabellinkclick events args)
linklabel1.linkvisited= true
system.diagnostics.process.start("www.yfc.com")
end sub

CREATING A LINKLABEL IN CODE

Dim withevents linklabel1 as linklabel
private sub button1_click(byval sender as system.objects,byval e as system.eventsargs)
linklabel1= new linklabel
linklabel1.autosize=true
linklabel1.location= new point(15,15)
linklabel1.size= new size(15,15)
linklabel1.text="interested?"
linklabel.links.add(14,11,"info")
linklabel1.links.add(33,4,"www.yfc.com")
ADDHANDLER LINKLABEL1.LINKCLICKED ,ADDRESSOF ME,LINKLABEL1_LINKCLICKED ME.CONTROLS.ADD(LINKLABEL)
Private sub linklabel1_linkclicked(byval sender as system.objects, byval e as system .windows.forms.linklabellinkclick events args)
linklabel1.links(linklabel1.links.indexof(e.link)).visited=true
If (e.link.linkdata.Tostring()="info") then
Dim a as new form2()
a.show()
else
Dim b as new form3
b.show()
end if
end sub
end class
 




0 comments:

Post a Comment

 

PROGRAMMINGqueen Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates

Blogger Widgets