|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ComboBox.Items.Clear()"Choose Value" cboTaxValue.Item.Insert(0, "Choose Value") Then I loop through the rest of the values to be added to the combobox. My problem is that when I try to clear the ComboBox it clears the items that were inserted into the ComboBox, but does not clear the item I selected in the ComboBox... For Instance. The ComboBox has three choices: "Choose Value", ".023", ".546". I choose ".023" from the list. After I select it, I make the needed changes and press the update button. At the end of the UpdateButton Method, I have a line of code: cboTaxValue.Items.Clear(). This line removes all of the items in the ComboBox except for the item I had previously selected. I have also tried cboTaxValue.SelectedText = String.Empty, that does not clear the item selected in the ComboBox either. Puzzled and confused I am. I hope this was enough explanation, appreciate any help. Scott Moore Use cboTaxValue.Text = String.Empty instead.
Thanks, Seth Rowe samoore33 wrote: Show quoteHide quote > I am populating a ComboBox at run time. I insert the first value of > "Choose Value" > > cboTaxValue.Item.Insert(0, "Choose Value") > > Then I loop through the rest of the values to be added to the combobox. > > My problem is that when I try to clear the ComboBox it clears the items > that were inserted into the ComboBox, but does not clear the item I > selected in the ComboBox... For Instance. > > The ComboBox has three choices: "Choose Value", ".023", ".546". I > choose ".023" from the list. After I select it, I make the needed > changes and press the update button. At the end of the UpdateButton > Method, I have a line of code: cboTaxValue.Items.Clear(). This line > removes all of the items in the ComboBox except for the item I had > previously selected. I have also tried cboTaxValue.SelectedText = > String.Empty, that does not clear the item selected in the ComboBox > either. > > Puzzled and confused I am. > > I hope this was enough explanation, appreciate any help. > > Scott Moore Seth,
You rock, that worked. Thanks a lot Scott Moore rowe_newsgroups wrote: Show quoteHide quote > Use cboTaxValue.Text = String.Empty instead. > > Thanks, > > Seth Rowe > > samoore33 wrote: > > I am populating a ComboBox at run time. I insert the first value of > > "Choose Value" > > > > cboTaxValue.Item.Insert(0, "Choose Value") > > > > Then I loop through the rest of the values to be added to the combobox. > > > > My problem is that when I try to clear the ComboBox it clears the items > > that were inserted into the ComboBox, but does not clear the item I > > selected in the ComboBox... For Instance. > > > > The ComboBox has three choices: "Choose Value", ".023", ".546". I > > choose ".023" from the list. After I select it, I make the needed > > changes and press the update button. At the end of the UpdateButton > > Method, I have a line of code: cboTaxValue.Items.Clear(). This line > > removes all of the items in the ComboBox except for the item I had > > previously selected. I have also tried cboTaxValue.SelectedText = > > String.Empty, that does not clear the item selected in the ComboBox > > either. > > > > Puzzled and confused I am. > > > > I hope this was enough explanation, appreciate any help. > > > > Scott Moore You can use
cboTaxValue.SelectedIndex = -1 or cboTaxValue.SelectedItem = Nothing to unselect a selected item. Kelly samoore33 wrote: Show quoteHide quote > I am populating a ComboBox at run time. I insert the first value of > "Choose Value" > > cboTaxValue.Item.Insert(0, "Choose Value") > > Then I loop through the rest of the values to be added to the combobox. > > My problem is that when I try to clear the ComboBox it clears the items > that were inserted into the ComboBox, but does not clear the item I > selected in the ComboBox... For Instance. > > The ComboBox has three choices: "Choose Value", ".023", ".546". I > choose ".023" from the list. After I select it, I make the needed > changes and press the update button. At the end of the UpdateButton > Method, I have a line of code: cboTaxValue.Items.Clear(). This line > removes all of the items in the ComboBox except for the item I had > previously selected. I have also tried cboTaxValue.SelectedText = > String.Empty, that does not clear the item selected in the ComboBox > either. > > Puzzled and confused I am. > > I hope this was enough explanation, appreciate any help. > > Scott Moore >
Sending email with attachments
writing commands to command prompt in VB.NET Data Set to Excel ? vb.net serial IO problem Open folders to process files automatically [Newbie] Customize Anchor properties ? SelectedIndexChanged causes selectedindex to reset to -1? How hard would this be? Q: Activated Regular Expression |
|||||||||||||||||||||||