Hi ...
Can u plzz help me ..
i want to put maximum validation for each control on my form..
it contain a textbox(input only alphabets), a combo box(display only Mr,Mrs, Miss), a datagrid..
and also how do i put a tool tip text on a textbox..

Note for the combo box i have already bind it but it displays all 5 Mr 2 Mrs and Miss
i just want it to be unique i.e Mr Mrs Miss

Need Help plzzzzzzz

About ComboBox you can control the data it bound to be unique i.e if you return data from database let it distinct

About tooltip, its show method take the control it shows if the cursor came on and the string it displayes i.e ToolTip1.Show(textbox1, "this is textbox")

About a textbox(input only alphabets) in text changed handler for the textbx\richtextbox it receives the key (last one) written on the textbox\richtextbox using some Char\char class method you can check if the key written was alphabet or digits and take the decision

This following code to input string only, other character wont allowed to input.

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If (Microsoft.VisualBasic.Asc(e.KeyChar) < 65) _
             Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 90) _
             And (Microsoft.VisualBasic.Asc(e.KeyChar) < 97) _
             Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 122) Then
            'space accepted
            If (Microsoft.VisualBasic.Asc(e.KeyChar) <> 32) Then
                e.Handled = True
            End If
        End If
        If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) _
        Or (Microsoft.VisualBasic.Asc(e.KeyChar) = 44) _
        Or (Microsoft.VisualBasic.Asc(e.KeyChar) = 45) _
        Or (Microsoft.VisualBasic.Asc(e.KeyChar) = 46) Then
            e.Handled = False
        End If
    End Sub

Tooltips :
drag tooltips control to your destination form then all of control has tooltips editor in their properties control. you can add text in tooltips properties (use like in vb 6).

This article has been dead for over six months. Start a new discussion instead.