Hello all, I have a few questions and some problems. I've been doing some searching on the web and cannot find a source that can aid me with these issues.

Anyways,
I have several text box's that need to have the following properties:
Numbers-Only
Commas Ex. 1,000 instead of 1000
Able to use: Backspace,Delete,Enter

So far I have the following code for the Numbers-Only Option, but when I use this code it only allows for numbers and nothing else. It disables the Backspace,Delete features that I would like to use.

Here is what I have thus far:

private void oicTxtInc_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))
                e.Handled = true;
        }

Now for the second issue.

When my program loads a Form is loaded or displayed before the main form.

private void Form1_Load(object sender, EventArgs e)
        {
            StartUp StDlg = new StartUp();
            StDlg.ShowDialog();
        }

This form displays some simply instructions on how to use my program and it contains a checkBox and is Checked by default. I would some how like to make it so when the user Un-Checks the box it does not appear at start up any more. I've seen this done in many programs that I have used in the past.
Kinda like a Tip of the day that contains a check box that is checked and once un-checked it stops showing the tips.

I just don't know how to bind the checkBox to anything to save status of it, nor do I know the correct syntax to use for this.

Any and all help is greatly appreciated.

Thanks in advance,
- Poab9200

OK the numbers only issue:

Your reg expression of \d is why, you need to include commas and dots.

for the "dont show this again" in the onchecked you set a registry (or ini file) setting to stop this, and when its missing or false, you show the message, when its true, you dont.

A couple of pointers;

Firstly regarding the limitation of button presses in your textbox. I would do this in javascript, that way you will not do a postback everytime a button is clicked.

In javascript you can use event.keyCode; to get the value of the key pressed. If the key id is not valid return false; (See http://www.geekpedia.com/tutorial138_Get-key-press-event-using-JavaScript.html)

Regarding the second problem. You are going to have to persist the form status on the user's machine. When the application loads check the current form status if enabled, open the form, if disabled don't open it. Have a look at User and System Properties in .NET.

I dont believe the OP is using webforms, but winforms, in whcih case javascript wouldnt be the way

Yes, your correct LizR.

1. I don't have any knowledge in Java ( not that i have much in CSharp either).
(I could always learn but rather not at the moment.)

2. I'm using a Windows Form Application Method.

3. I'll most defnitally look in the User, and System Properties of the .NET

good luck

Ok I've done some reading and I believe I understand how to tackle the "Don't Show again" item, but I am still having issues with the textbox.

My question (directed at LizR) is what parameters may I substitute the "\d" for?
I had copied this line of code from a snippet here on this site. I'm not sure what parameters their are for the Regex namespace.

Code ::

if 
(!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))
e.Handled = true;

** Off Topic **
What is the Rep Power for next to some posting info?

Have a read of regular expressions - its not hugely a complicated as a subject, but its power is astronmic, I couldnt do it justice in a post..

As for rep power, you may notice you can "add to "someones rep, the rep power is how much influence they have if they do that