PDA

View Full Version : [SOLVED] Hide textbox with selected item in combobox



tlchan
05-01-2020, 02:45 AM
I wish to hide the related textbox for the selected item in combobox but it seem not working. Could anyone assist to identify the error?


Private Sub Cbproduct_Change() Dim i As Integer




For i = 0 To ListCount - 1
If Cbproduct.ListIndex.Selected(3) Then

TbAmount.Visible = False
LbAmount.Visible = False
TbCard.Visible = True
Lbcard.Visible = True


End If


Next i


End Sub

paulked
05-01-2020, 03:30 AM
There is no ListCount or ListIdex in a ComboBox.



Private Sub Cbproduct_Change()
'Dim i As Integer




'For i = 0 To ListCount - 1
If Cbproduct = "Something" Then '.ListIndex.Selected(3) Then

TbAmount.Visible = False
LbAmount.Visible = False
TbCard.Visible = True
Lbcard.Visible = True


End If


'Next i


End Sub

tlchan
05-01-2020, 07:33 AM
There is no ListCount or ListIdex in a ComboBox.



Private Sub Cbproduct_Change()
'Dim i As Integer


'For i = 0 To ListCount - 1
If Cbproduct = "Something" Then '.ListIndex.Selected(3) Then

TbAmount.Visible = False
LbAmount.Visible = False
TbCard.Visible = True
Lbcard.Visible = True


End If


'Next i


End Sub



Attached working file for better clarification. What I intended to achieve is when item 3 was selected in the combo box, the some text box become invisible/visible.


Thank you

paulked
05-01-2020, 08:34 AM
Private Sub Cbproduct_Change()
If Cbproduct.ListIndex = 3 Then
TbAmount.Visible = False
LbAmount.Visible = False
TbCard.Visible = True
Lbcard.Visible = True
End If
End Sub

tlchan
05-01-2020, 06:43 PM
Private Sub Cbproduct_Change()
If Cbproduct.ListIndex = 3 Then
TbAmount.Visible = False
LbAmount.Visible = False
TbCard.Visible = True
Lbcard.Visible = True
End If
End Sub


Dear Paulked,

You are great!

Thank you

paulked
05-02-2020, 01:39 AM
You're welcome :thumb