How to create a control to do this?...

J

Jason

I would like to create a control to do something like this:

accept a numeric value (>0 and <=3899) in the textbox, convert it to a
Roman Numeral and display it in a label. Write functions called from
the Leave event of the textbox to validate the entry in the textbox and
convert it to Roman.
The entry of an invalid value in the textbox should result in the entry
going away, the textbox becoming yellow and getting focus. Valid
entries should turn the textbox green and the control itself medium
seagreen and display the Roman Numeral in the label.

anyone have any ideas how this would be done?
 
C

Cerebrus

Hi Jason,

I did something similar a while back, though I didn't create a
UserControl to do it.I just created a RomanConverter Class library.

1. Create a Class that converts integers to Roman numerals. You can
find an excellent example at
"http://www.vb-helper.com/howto_roman_arabic.html". There are lots of
other samples on the web, many in VB. Another one is :
"http://www.thevbprogrammer.com/Ch08/08-10-RomanNumerals.htm"

2. Create your UserControl, referencing the above class, and adding all
validation code as necessary. I assume you are familiar with the
nuances of User control creation.

3. Compile your code and add that control to a Windows form to test it
out.

Note that Roman numbers are normally considered upto 3999 and not 3899.

Hope this helps,

Regards,

Cerebrus.
 
C

Cerebrus

LOL, Hi Cor,

That's nice to hear, but whatever do *you* need the links for ?

Regards,

Cerebrus.
 
C

Cor Ligthert [MVP]

Cerebrus,

When there comes again chalenges to create this smaller to have the samples.

This is are nice things to do just for fun to make it as short as possible.

We did this already once in a kind of way in this newsgroup with Roman
(Latin) to (west) Arabian.

Cor
 

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