.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to insert sum value of two text boxes into third text box

Posted By: Manir     Posted Date: September 22, 2012    Points:5   Category :C#
I have three text boxes in a form and two check box associated to textbox1 and textbox2.
Another textbox is named as grandtotal. When I checked on check box it insert value in two text boxes. Now I want to insert sum of value into third text box which is named as grandtotal

Below are the my codes for the text box 1 and text box 1


private void checkBoxAdmission_CheckedChanged(object sender, EventArgs e)
{
SQLHelper objsql = new SQLHelper();
objsql.SqlText = " select SettingID,SettingValue from tblSettings where SettingID = 1";

objsql.AddParameter("FeetypeID", checkBoxAdmission.Checked);
DataTable dt = objsql.getDataTable(false);
if (dt.Rows.Count > 0)

txtAdmissionFee.Text =dt.Rows[0]["SettingValue"].ToString();

objsql.Close();
objsql.Dispose();
}

private void checkBoxMonthly_CheckedChanged(object sender, EventArgs e)
{
SQLHelper objsql = new SQLHelper();
objsql.SqlText = " select SettingID,SettingValue from tblSettings where SettingID = 2";

objsql.AddParameter("FeetypeID", checkBoxMonthly.Checked);
DataTable dt = objsql.getDataTable(false);
if (dt.Rows.Count > 0)

txtMonthlyFee.Text = dt.Rows[0]["SettingValue"].ToString();

objsql.Close();
objsql.Dispose();
}

private void txtGrandTotal_TextChanged(object sender, EventArgs e)
{

}



Responses
Author: Jack Smith             
Posted Date: September 23, 2012     Points: 20   

That is exect true coding for defining value in text box.

Click Here for More Information about .Net Developer of India
Author: Narayanan             
Posted Date: September 25, 2012     Points: 20   

Hi,
you bind two values in the TextBox(like txtMonthlyFee.Text,txtAdmissionFee.Text). Now add two values like this
txtGrandTotal.Text = Convert.ToInt32(txtAdmissionFee.Text) + Convert.ToInt32(txtMonthlyFee.Text);


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Andrew Hudson             
Posted Date: July 23, 2013     Points: 20   

this is a true code bind the two value in the text box.and added the two value.



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend