-
October 27th, 2010, 09:05 PM
#1
ComboBox
I have a combobox with whose contents get populated via code. Works ok. But When I select something in the list and hit 'OK' it always returns as: nothing, "", or -1 (tried with .selectedValue, .SelectedText, and .SelectedIndex respectively)
Question is, How do you access the text in a ComboBox's selected Value??
-
October 27th, 2010, 09:11 PM
#2
Re: ComboBox
Download the samples from my signature.
It should help...
-
October 27th, 2010, 10:27 PM
#3
Re: ComboBox
Looking at the ListboxCombobox sample. I don't get it, that appears to be exactly what I have. The only difference is my code for that part is located in a module, and I have to refer to my main form
eg:
Code:
var = frmMain.cboDropDown.Text.ToString
still comes back as ""
-
October 28th, 2010, 02:09 AM
#4
Re: ComboBox
Did you see this?
Code:
Private Sub cboDemo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboDemo.SelectedIndexChanged
If cboDemo.SelectedIndex > -1 Then
lblResults.Text = cboDemo.SelectedValue.ToString
Else
lblResults.Text = String.Empty
End If
End Sub
Otherwise, set up a PUBLIC function in the form, to return the value, then call it from your module (when the form is loaded)
GetValue()
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
|