Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16037

Which is Appropriate ComboBox1 Event to show a Msg that combobox1.item Does not Exist

$
0
0
Hello

Which is the most appropriate ComboBox1 Event to show a message that combobox1.item Does not Exists

ie user types wrong string/text in Combobox1 and Msg to POP up "Item Not there in the List"


a.) Typing few characters in Combobox1 and Msgbox Poping up OR
b.) Typing full string/Text (Wrong Entry itself) then Msgbox Poping up

preferable choice would be Option a.)
Code:

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        Textbox1.Text = dt.Rows(Combobox1.SelectedIndex).Item(1)
        Textbox1.Update 'Updates the textbox
End Sub

Code:

If ComboBox1.Items.Contains(ComboBox1.Text) Then
 Else
 MsgBox "Item Not there in the list"
 End if

Almost explored everything but somehow could not succeed
Do we have something like
Code:

If Not ComboBox1.Items.Contains(ComboBox1.Text) then
MsgBox "Item Not there in the list"
End if

or any different syntax

for whole coding you may refer my thread 892141 in this forum

Thanks
SamD
Thread 3: 892182
18

Viewing all articles
Browse latest Browse all 16037

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>