2 Replies - 1318 Views - Last Post: 26 April 2015 - 10:55 AM

#1 Recoil  Icon User is offline

  • D.I.C Addict

Reputation: 51
  • View blog
  • Posts: 504
  • Joined: 28-June 08

Multiple masked textbox formats - other options?

Posted 26 April 2015 - 08:44 AM

I could not think of another title for this.

Currently I am using a masked text box on my form with the Mask set to (00d999+99). The first "00" is for the number of dice used, "999" is for which die to use, and the last "99" is for an optional modifier.

This works if I input something like 01d012+03. I would also like to be able to save values like "1d4" (no + modifier) & "4d12+3", but the mask must have the zeros in order for it to display in the masked text box properly.

I have thought about simply using 3 different text boxes for the number of dice, the die, and the modifier. I have also thought about creating a custom textbox and validating the text against all the possible formats during the leave focus event.

These are the ideas that I have been able to come up with, but I wanted to see if someone could offer an option I have not thought of.

Sorry, I have NO idea why sometimes it posts double posts.

Is This A Good Question/Topic? 0
  • +

Replies To: Multiple masked textbox formats - other options?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13397
  • View blog
  • Posts: 53,465
  • Joined: 12-June 08

Re: Multiple masked textbox formats - other options?

Posted 26 April 2015 - 10:14 AM

Why not just create a custom control that deals with three inputs? Have it grab, validate, parse, etc all the data.. then you can plunk it down how ever many times you need.
Was This Post Helpful? 1
  • +
  • -

#3 Recoil  Icon User is offline

  • D.I.C Addict

Reputation: 51
  • View blog
  • Posts: 504
  • Joined: 28-June 08

Re: Multiple masked textbox formats - other options?

Posted 26 April 2015 - 10:55 AM

That was the second idea I had come up with, just a custom control & validate the values, only allowing "#'s", "d", & "+". The first idea was just to save 3 textbox values into a string with the "d" & "+", then just parse when I have to load it. I could also make that into a control as well.

I wasn't sure if these were the only feasible options. I'll probably end up going with the 3 textbox values since it is just easier to code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1