Microsoft
Software
Hardware
Network
Question : VB .NET resetting a combo box
I have a form where the user will choose 1 of 2 options, by radio button.
When button 1 (rbVar1byValue) is clicked, a combo box is enabled and populated. The options under button 2 are disabled. (this works correctly)
When button 2 (rbVar1byName) is clicked, a text box is enabled for data entry. (this also works correctly)
If button 1 is clicked then the user changes their mind and clicks button 2, I want the combo box reset (to blank) without having to repopulate the combo box.
The current entries in the combo box are:
blank
Color
Type
Count
Here's what I have for CheckedChanged:
--------------------------
---------
Private Sub rbVar1byValue_CheckedChang
ed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbVar1byValue.CheckedChang
ed
If rbVar1byValue.Checked = True Then
cmbBx1ValueField.SelectedT
ext = ""
dfBx1ValueFieldsFound.Text
= ""
cmbBx1ValueField.Enabled = True
cmbBx1ValueFieldValues.Ena
bled = True
cmbBx1ValueExpr.Enabled = True
dfPrefix1NmFieldsFound.Tex
t = ""
dfBx1NmFieldsFound.Text = ""
dfPrefix1NmFieldsFound.Ena
bled = False
dfOutputNm1.Enabled = True
cmbBx1ValueField.Focus()
End If
End Sub
Private Sub rbVar1byName_CheckedChange
d(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbVar1byName.CheckedChange
d
If rbVar1byName.Checked = True Then
cmbBx1ValueField.Text = ""
cmbBx1ValueField.Enabled = False
dfBx1ValueFieldsFound.Text
= ""
cmbBx1ValueFieldValues.Ena
bled = False
cmbBx1ValueExpr.Enabled = False
dfPrefix1NmFieldsFound.Tex
t = ""
dfPrefix1NmFieldsFound.Ena
bled = True
dfBx1NmFieldsFound.Text = ""
dfOutputNm1.Enabled = True
dfPrefix1NmFieldsFound.Foc
us()
End If
End Sub
--------------------------
------
There is obviously something I do not understand on combo boxes.
Thanks in advance for help!
Answer : VB .NET resetting a combo box
Oh ok, then you just want to do:
cmbBx1ValueField.SelectedI
ndex = -1
Random Solutions
How to do an insert into a multi-value column
How can I use VB to tab my cursor to different text boxes?
IBM Thinkpad R51 Can't get internet connection
Major problem with AJAX and server.transfer to AJAX page
Request timed out - help!
netsh command to stop firewall in windows server 2008
MS Office on Mac OS 10.5.7 - do you want the application microsoft word to accept incoming network connections
Windows 2008 R2 Upgrade on SQL 2008 Cluster
Getting Error message in IE
system scan