Groups | Blog | Home
all groups > dotnet faqs > august 2006 >

dotnet faqs : ComboBox VB.net question


Coderacer
8/1/2006 11:41:46 AM
Hi

I have an Array(20) and 2 ComboBoxes in my form class. My idea is to
add items of Array to ComboBox2 in such a way that if, say, you make a
choice A in ComboBox1, Array items 1 thru 10 will get added; If you
choose choice B in ComboBox1, Array items 1-20 items gets added to
ComboBox2. So far so good, BUT THE PROBLEM IS

When I start the form and make a selection A in ComboBox1, Array items
1thru 10 are getting added without a problem. Now if I choose B in
ComboBox1, Array items 1 thru 20 are getting APPENDED to already
existing 1 thru 10 items from previous selection. I tried to write
following code to refresh the ComboBox selections, when I ever I change
SelectIndexChanged for ComboBox1, but no success. Can anybody please
help, I appreciate any help. Thank you.

N = Integer.Parse(ComboBox2.Items.Count)
MsgBox("N")
For L = 0 To N - 1
ComboBox2.Items.RemoveAt(L)
Next L
Scott M.
8/1/2006 6:15:53 PM
Is this an ASP.NET application? If so, set the ComboBox's EnableViewState
property to False.


[quoted text, click to view]

AnsweringMachine
8/2/2006 9:29:31 PM
ComboBox2.Items.Clear()

[quoted text, click to view]
AddThis Social Bookmark Button