PDA

Click to See Complete Forum and Search --> : a quick one for yaa


aerohaith
Dec 9th, 2002, 09:07 PM
how do get an item in cobBox1 appear automatically when u search
for an item . so if an item is found then show the item in cobBox1 else show MsgBox.

Private Sub cmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
Dim itemSearch As Integer
Dim itemFound As Boolean
For itemSearch = 0 To (cobProduct.Items.Count - 1)
If (txtSearch.Text) = CStr(cobProduct.Items.Item(itemSearch)) Then
itemFound = True

cobProduct.Items.Item(itemSearch) ' error / this line to be checked
MsgBox(" herryaa") ' a test to indicate item found = true


End If
Next itemSearch
If itemFound = False Then
MsgBox(" product not found", MsgBoxStyle.Exclamation)
txtSearch.Text = ""
End If
End Sub

thank u

DevGrp
Dec 9th, 2002, 09:26 PM
how do get an item in cobBox1 appear automatically when u search for an item . so if an item is found then show the item in cobBox1 else show MsgBox.


You were not too clear, but let me see if I understand. You want to search a textbox for a string. If the string is not in the combobox you want to add it? Its this correct??

aerohaith
Dec 10th, 2002, 08:03 AM
there 's something wrong with the next line.. i want to search, if found select the searched item then display it (no adding it, since it's already there in a file attached to cobBox), if found = false then display error message

cobProduct.Items.Item(itemSearch)

aerohaith
Dec 10th, 2002, 08:31 AM
what my idea is, search through items in cobBox since they are already loaded there from a file.txt, and if found select it and display (like selecting it by clicking the arrow, scrolling down the list) in the same cobBox