Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private void AmountPaid_TextChanged(object sender, System.EventArgs e)
{
     Regex regex = new Regex("^[0-9]*&");
    if(regex.IsMatch(this.AmountPaid.Text) && !string.IsNullOrEmpty(this.AmountPaid.Text.Trim()))
    {
    double Balance1;
    double Amount1 = Convert.ToDouble(this.Amount.Text);
    double Amount2 = Convert.ToDouble(this.AmountPaid.Text);

        Balance1 = Amount1 - Amount2;
        //Convert.ToDouble(this.Balance.Text)= Balance1;
        this.Balance.Text = Convert.ToString(Balance1);

    }
}

Using statements
using Microsoft.VisualBasic;
using BaseClasses.Web.UI.WebControls;
using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseClasses;
using BaseClasses.Data;
using BaseClasses.Utils;
using ReportTools.ReportCreator;
using ReportTools.Shared;
using System.Text.RegularExpressions;
Posted
Updated 21-Jul-11 21:14pm
v3
Comments
shefeekcm 22-Jul-11 3:02am    
check your pageload
Mario Majčica 22-Jul-11 3:16am    
It is actually not a good idea to make a round trip on each TextChanged event. You could easily do this via javascript on client side or on let say a button that commits this operation and generates the postback.
shefeekcm 22-Jul-11 3:18am    
did you solved your probelm..
ssempijja 22-Jul-11 3:42am    
i think this will be better idea. To put it no the button which commits an operation
ssempijja 22-Jul-11 3:46am    
It soloved the problem but the text target textbox is still left blank although when there is a chnage on triger text boxes. As u have seen the code above

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900