|
-
January 20th, 2010, 07:11 PM
#1
[RESOLVED] Combobox ListIndex
I am trying to have the index value of a selected item in a combobox returned to a variable. Then, if the variable = 1 (which would be the index of th second item in the combobox), I want a groupbox to be hidden (be invisible) on the form. Here is my code...Getting an error that says:
'ListIndex' is not a member of 'System.Windows.Forms.ComboBox'
Code:
Private Sub cbxAccounts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim selection As Integer = CInt(cbxAccounts.ListIndex)
If selection = 1 Then gbxCheck.Hide()
End Sub
-
January 20th, 2010, 10:42 PM
#2
Re: Combobox ListIndex
Got it to work. Here is the code.
Code:
Private Sub cbxAccounts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAccounts.SelectedIndexChanged
' Hide "Check" Groupbox when "Savings" is selected from "Accounts" Combobox
Dim selection As String = cbxAccounts.SelectedItem
If selection = "Savings" Then gbxCheck.Visible = False Else gbxCheck.Visible = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|