listbox error...[RESOLVED]
hai,
i had a code in command button click event given bellow:
private sub command_click event()
For i = 0 To Lst_Itm_Cat.ListCount - 1
If Lst_Itm_Cat.Selected(i) = True Then Lst_Itm_Cat.Selected(i) = False
Next
end sub
as well as i had a code in lst_itm_cat (listbox control) click event. my problem is whenever i call the command click event the lst_itm_cat (listbox control)click event was trigred. i don't know why? plz help me...how to avoid this...
Re: listbox error...[RESOLVED]
As soosn as you select or deselect items in listbox, it will generate click event.
So try to declare a global boolean variable for detecting if the command button is pressed.
Like this;
VB Code:
Dim bButtonClicked As Boolean
Private Sub Command1_Click()
bButtonClicked = True
For i = 0 To lst_itm_cat.ListCount - 1
If lst_itm_cat.Selected(i) = True Then lst_itm_cat.Selected(i) = False
Next
bButtonClicked = False
End Sub
Private Sub Form_Load()
bButtonClicked = False
End Sub
Private Sub lst_itm_cat_Click()
If bButtonClicked Then Exit Sub
'Your code for ListBox Click Event
End Sub
Re: listbox error...[SOLVED]
thanks sishe.....u r from .......i am new to vb. so plz tell me tricks and tips abt vb 6.0
bye..
regards
RajeshKumar.M