Why don't my DomainUpDown controls behave correctly?

  • Thread starter Thread starter Tim Osborne
  • Start date Start date
T

Tim Osborne

I have used the DomainUpDown control in my UI to allow a user
to switch units from KB to MB to GB.
The initial text is set to MB.

When the form presents and I click on the upper arrow of the spin portion of
the control
nothing happens.

If I click on the down arrow a couple of times it changes selection and then
the up and down work
correctly.

I have seen this behavior in the simplest example I could produce.
A WinForm with nothing on it but a DomainUpDown.
There are three items defined for the control: KB,MB,GB.
I set the text in the designer to MB.

Is this control just plain broke?
 
Hi,

Tim Osborne said:
I have used the DomainUpDown control in my UI to allow a user
to switch units from KB to MB to GB.
The initial text is set to MB.

The DomainControl starts with nothing selected (SelectedIndex = -1), so you
can use the Text property to display something that's not in the list, like
"Please select something ....".

But if you want the DomainControl to start with a certain item selected,
then you don't need to set the Text property, but set SelectedIndex to the
index of the item you want, in your case that would be 1 since it's 0 based
:

Form_load (....)
{
domainUpDown1.SelectedIndex = 1; // MB
}


HTH,
Greetings
 
Back
Top