ComboBox remains selected after databind

  • Thread starter Thread starter Dirk Meusel
  • Start date Start date
D

Dirk Meusel

I use several Comboboxes on my Windows Forms that are programmed with
VB.NET and VS 2002. For reasons of convenience, the Comboboxes are
filled by databinding them to a dataset. Everything works fine, except
that all Comboboxes are by default marked (or better: the text shown
is selected). Only after clicking once into each Combobox, they appear
in the usual way unselected or unmarked. Its kind of nothing much
important, but when i open a winform with 10 Comboboxes in it, it
looks quite confusing to all of them marked.

So, how can I get the Comboboxes appearing unmarked after they are
bound to a dataset???

I already tried Refreshing the form after databinding as well as
setting the focus to each of the Comboboxes. Neither of these worked.
Any suggestions???

Thanks all!
Dirk Meusel
 
Dirk,

Probably is it solved when you set the selectedindex two times to -1

It is a known bug.

Cor
 
Thanks Cor, for your reply, but it does not work either. I tried it
the following way in every combination within the FormLoad Event as
well as after the Oleadapter fills the dataset (which is in a separat
function).

Me.cmb1.SelectedIndex = -1
Me.cmb1.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1

Any more suggestions?

Dirk
 
Do it after all databinding

Dirk Meusel said:
Thanks Cor, for your reply, but it does not work either. I tried it
the following way in every combination within the FormLoad Event as
well as after the Oleadapter fills the dataset (which is in a separat
function).

Me.cmb1.SelectedIndex = -1
Me.cmb1.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1

Any more suggestions?

Dirk

"Cor Ligthert" <[email protected]> wrote in message
 
Maybe this helps

me.cmb1.SelectionLength = 0
me.cmb2.Selectionlength = 0

hth
gr Peter
 
Hi Peter,

It worked not out as well, even the combination of both does not have
any effect, I tried:

me.cmb1.SelectionLength = 0
me.cmb2.Selectionlength = 0

as well as:

Me.cmb1.SelectedIndex = -1
Me.cmb1.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1
Me.cmb2.SelectedIndex = -1
me.cmb1.SelectionLength = 0
me.cmb2.Selectionlength = 0

thanks, Dirk

*****************************************************+
From: Piedro
Date Posted: 9/1/2004 5:25:00 AM



Maybe this helps

me.cmb1.SelectionLength = 0
me.cmb2.Selectionlength = 0

hth
gr Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top