Question: i have textbox only allow decimals and '+' 
it allow only 1 Decimal "12.332" i need to allow 1 decimal before '+' and 1 decimal after '+' Example i have 12.43+12.23 i can't type the 12(.) because i allow only 1 decimal i am using Split method to get 2 parts before and after

and it is my code 

```
// checks to make sure only 1 decimal is allowed
if (e.KeyChar == 46)
{
    if ((sender as TextBox).Text.IndexOf(e.KeyChar) != -1)
        e.Handled = true;
}

```

And this is My method 

```
if(textBox1.Text.Contains('+')==true )
{
    string Value = textBox1.Text;
    string[] tmp = Value.Split('+');
    string FirstValu = tmp[1];
    string SecValu = tmp[0];
}

```

how to use method with event to allow another decimal place after '+'

Answer: 
I would say use two text boxes like someone said in the comments but if you want to be stubborn here is a function to run inside an event that is called when the text changes in the text box.

```
void textbox_textChanged(object sender, EventArgs e)
    {
        string text = textBox.Text;
        int pointCounter = 0;
        int addCounter =0
        string temp = "";
        string numbers = "0123456789";
        for(int i =0;i<text.Length;i++)
        {
            bool found = false;
            for(int j = 0;j<numbers.Length;j++)
            {
                if(text[i]==numbers[j])
                {
                    temp+=text[i];
                    found = true;
                    break;
                }
            }
            if(!found)
            {
                if('.' == text[i])
                {
                    if(pointCounter<1)
                    {
                        pointCounter++;
                        temp+=text[i];
                    }
                }else
                    if('+' == text[i])
                    {
                        if(addCounter<1)
                        {
                            pointCounter=0;
                            addCounter++;
                            temp+=text[i];
                        }
                    }
            }
        }
        textBox.text = temp;

    }

```
I would recommend using a Regex to validate your textbox. I would also suggest that using the textbox Validating event would be better than using the Leave event. Here is an example of using a regex in the Validating event:

```
private void textBox1_Validating(object sender, CancelEventArgs e)
{
    TextBox tbox = (TextBox)sender;

    string testPattern = @"^[+-]?[0-9]*\.?[0-9]+ *[+-]? *[0-9]*\.?[0-9]+$";
    Regex regex = new Regex(testPattern);

    bool isTextOk = regex.Match(tbox.Text).Success;
    if (!isTextOk)
    {
        MessageBox.Show("Error, please check your input.");
        e.Cancel = true;
    }
}

```

You will find the Regex class in the `System.Text.RegularExpressions` namespace. Also make sure your textbox has the `CausesValidation` property set to true.

As an alternative you might also want to look at using the [MaskedTextBox Class](http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx).