.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 >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

asp.net

Posted By: Aamrapali Tamgadge     Posted Date: February 22, 2011    Points:2   Category :ASP.Net
Hi Me having 7 textboxes in one row and anoather two textboxes are for Quantity and total but initialy ther is no value in textboxes even i can set it to 0 b bcoz of requirement ple anyone help m eout how can i perform the addition of all the textboxes and show it an Quantity textbox..

Responses
Author: Naresh             
Posted Date: February 22, 2011     Points: 5   

hi,
if iam correct that ur question is to added all the textbox value and display in one text box,

then u can add a button ,and double click the button and u can added the code,

like this u can try,

int a=text1.text;
int b=text2.text;
int c=text3.text;

if u want the output in textbox7 then
textbox7.text=a+b+c;



Thanks
Naresh
Author: Aamrapali Tamgadge             
Posted Date: February 22, 2011     Points: 5   

hi i have already Applied this But Initialy the TextBox is Blank So It Getting The error Input string Was not in Correct format..

Software Programmer At OTIS ISRC
Author: Sunil Yadav       [Moderator]      
Posted Date: February 22, 2011     Points: 5   

Here you should perform validation before performing any operation.

Author: Aamrapali Tamgadge             
Posted Date: February 22, 2011     Points: 5   

hi..Sunil sir..
M not able to find the related to ur link can u send me dat.

Software Programmer At OTIS ISRC
Author: Sunil Yadav       [Moderator]   Accepted Answer   
Posted Date: February 22, 2011     Points: 10   

Initially set all variale to 0.

int val1=0;
int val2=0;
int val3=0;
int val4=0;
int val5=0;

if(txt1.Text!=String.Empty)
{
val1=Convert.ToInt31(txt1.Text);
}

in similar fashion you can do it for rest of the variables.

Apart from this i would recommend you go through following link.

http://msdn.microsoft.com/en-us/library/aa479013.aspx


Author: prakash1598             
Posted Date: February 22, 2011     Points: 5   

hi if you have to give the input then you can try it

int a, b, c;
a = Convert.ToInt16(TextBox1 .Text );// convert the value
b = Convert.ToInt16(TextBox2 .Text );//ditto
c = a + b;
TextBox3.Text = "" + c;// this will show in the last text box


in the same way you can declare the more variable and add them in the quantity text box will show the
sum ...so check it out



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