numericUpDown but with non-numeric items.

J

Jon Slaughter

I would like to use the numericUpDown in it standard way but have to
features. I would like to display items instead of numbers that amp to the
numbers and have the control be "cyclic" in the sense that once it reaches
its maximum value it goes to its min and vice versa.

What I essentially want is to display something like
SomeArrayList[numericUpDown1.Value] instead of Value. I tried to override
the UpdateEditText but the problem is that now the user can enter numbers in
the text box of the numeric control. So I need to disable that in some way.

I also need to make it "cylical" but I think thats easy enough by just
adding to the changed value event.

So I guess the real issue is somehow disabling the user from entering input
to the numeric contro's text box and force it to use the up/down arrow keys
or the mouse.

Now, I also tried to use a combo box and this has similar issues(although
I'd rather use the numeric control as it allows me to get the index of the
entry directly which is easier to work with).

Is there a control that does what I want or do I have to modify my own?

Thanks,
Jon
 
J

Jon Slaughter

Bela Istok said:
do one control, yourselft.

Regards,


Thats what I'm doing but I don't want to start from scratch. The
numericUpDown doesn't seem to allow one to do much configuring though.
 
M

Marc Gravell

So, the DomainUpDown, then...

using (Form f = new Form())
using (DomainUpDown dud = new DomainUpDown())
{
dud.Items.AddRange(new string[] { "a", "b", "c", "d" });
dud.Wrap = true;
dud.SelectedIndex = 0;
f.Controls.Add(dud);
Application.Run(f);
}

Marc
 
J

Jon Slaughter

Marc Gravell said:
So, the DomainUpDown, then...

using (Form f = new Form())
using (DomainUpDown dud = new DomainUpDown())
{
dud.Items.AddRange(new string[] { "a", "b", "c", "d" });
dud.Wrap = true;
dud.SelectedIndex = 0;
f.Controls.Add(dud);
Application.Run(f);
}

Marc


Thanks. Pretty must exactly what I need. It would be nice though if it could
also drop drown like a combo box for quick access to the list? (I don't
think this control as this ability though ;/

There also seems the issue of the user entering in text. They can enter in
random stuff that doesn't match anything in the list ;/

Thanks though, this should work for now atleast.

Jon
 
M

Marc Gravell

ReadOnly disables the user editing - it does not (despite the name) make it
fully read-only; enabled handles that...

But no drop down... sorry...

Marc
 
J

Jon Slaughter

Marc Gravell said:
ReadOnly disables the user editing - it does not (despite the name) make
it fully read-only; enabled handles that...

yep, just saw that. Thanks for point it out though.
But no drop down... sorry...

Ok, no big deal. Might try to implement a custom control based on it later
though. Just trying to get a small app done so don't need it to be perfect.

Thanks,
Jon
 

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

Top