Saturday, April 6, 2013

Listbox

         Listbox control का use form मे list को display करने के लिए किया जाता हैं। Listbox user को selection provide करता है जिसमे user single या multiple items को select कर सकता है। इसमे items की एक list display होती है। जिसमे user items select कर सकता है।
Properties: सभी common properties इसमे apply होंगी। इसकी other important properties निम्न हैं।
1.   Items: यह listbox की सबसे important property है। यह एक collection है जो की listbox मे items को contain करती है और उन्हे manipulate करने के लिए use की जाती है। यह कई methods provide करती है जो methods मे define हैं।
MsgBox (ListBox1.Items.Item (2))
2.   MultiColumn: इस property के ture होने पर listbox मे items multiple columns मे display होते हैं।
         ListBox1.MultiColumn = True

3.   SelectionMode: यह property list items के selection mode को define karne के लिए use की जाती है। इसके निम्न values होती है।
None
No selection
One
Default, Single item can be selected
MultiSimple
Simple multiple selection, mouse click is used to select items
MultiExtended
Extended Multiple Selection, Mouse Click is used with Control key to select items.     
ListBox1.SelectionMode = SelectionMode.One

4.   Sorted: इसके ture होने पर list के items automatically asending या desending order मे sort हो जाएंगे।
   ListBox1.Sorted =True

5.   Text: इस property का use listbox मे select किए गए item या text को get करने के लिए किया जाता है।
MsgBox(ListBox1.Text)

6.   SelectedText/ SelectedItem: इन दोनों properties का use listbox मे select किए गए item को get करने के लिए किया जाता है।
MsgBox(ListBox1.SelectedItem)

7.   SelectedIndex: इसका use listbox मे select किए गए item की index get करने के लिए किया जाता है।
MsgBox(ListBox1.SelectedIndex)

Methods: इसमे show (), hide () और focus () method को apply किया जाता सकता है। साथ ही इसमे items collection मे निम्न methods होती हैं।
1.   ADD: इस method का use Items collection मे items को add करने के लिए किया जाता है। इसमे single argument होता है। item argument object type का होता है।
Syntax-       Listbox.Items.Add (Item)
Ex-           ListBox1.Items.Add ("Monday")
ListBox1.Items.Add ("Tuesday")
ListBox1.Items.Add ("Wednesday")
ListBox1.Items.Add ("Thursday")
ListBox1.Items.Add ("Friday")
ListBox1.Items.Add ("Saturday")
ListBox1.Items.Add ("Sunday")

2.   Remove: इस method का प्रयोग items collection से किसी item को remove करने के लिए किया जाता है। किसी item को remove करने के लिए उस item के नाम का use किया जाता है। इसमे Item का name, object type मे होती है।
Syntax-              Listbox.Items.Remove (Item)
Ex-                  ListBox1.Items.Remove ("Sunday")

3.   RemoveAt: इस method का प्रयोग items collection से किसी item को remove करने के लिए किया जाता है। किसी item को remove करने के लिए उस item की index का use किया जाता है। इसमे Item का index, integer type मे होती है।
Syntax-              Listbox.Items.RemoveAt (Item)
Ex-                  ListBox1.Items.RemoveAt (5)

4.   Clear: इस method का use, items collection से सभी items को एक साथ remove करने के लिए किया जाता है।
Syntax-       Listbox.Items.Clear ()
Ex-           ListBox1.Items.Clear ()

5.   Insert: इस method का use Items collection मे किसी Item को insert करने के लिए किया जाता है। Item को collection मे insert करने के लिए उस position की index का use किया जाता है। इसमे दो arguments होते हैं। पहला argument index होती है जो integer type की होती है। और second argument, Item होता है जो की object type का होता है।
Syntax-       Listbox.Items.Insert (Index, Item)
Ex-           ListBox1.Items.Insert (1, "Friday")

6.   Contains: इस method का use, Items collection मे किसी Item को check करने के लिए किया जाता है। यदि वह item collection मे available होता है तो यह ture value return करती है और यदि item collection मे नहीं होता है तो यह false return करती है।
Syntax-       Listbox.Items.Contains (Item)
Ex-           Dim b as Boolean = Listbox1.Items.Contains (“Friday”)
7.   Count: यह एक property है जो कि items collection मे items को count करने के लिए use की जाती है।
Syntax-       Listbox.Items.Count
Ex-           MsgBox (Listbox1.Items.Count)
Events: इसमे सभी common events apply उपस्थित होती हैं। इसके अलावा इसकी सबसे main event SelectedIndexChanged है।
·         SelectedIndexChanged: यह event Listbox मे किसी भी Item को select करने पर होती है। जब किसी भी item को select करते हैं तब selected index change हो जाती है तब यह event perform होती है।
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

End Sub



Monday, March 25, 2013

Label

Label control windows मे use होने वाला सबसे important control है जो कि किसी भी message को display करने के लिए किया जाता है। इसमे लिखा गया text को runtime मे बिना coding के नही modify किया जा सकता है। इसके use others controls के बारे मे information display करने के लिए किया जाता हैं।
Properties:

·         Autosize: इसके ture होने पर label कि size text के according automatically change हो जाती है।


यह भी windows operating system मे use होने वाला most important कंट्रोल है जो कि किसी work को perform करने के लिए use किया जाता है। इसकी मुख्य event click होती है। button के click event के लिए लिखे गए codes, button मे click करने पर execute होते हैं और define किए गए work को perform करते हैं।

Properties: सभी common properties इसमे apply होती हैं।

Methods: सभी common methods, clear () को छोड़कर इसमे apply होती हैं। performClick () इसकी important method है जो कि coding के द्वारा button पर click करने के लिए use की जाती है।

       Button1.PerformClick ()

Events: सभी common events इसमे apply होती हैं। click button कि सबसे important event है।

Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       MsgBox ("Button Click")
End Sub


Contact us

Name

Email *

Message *