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

how to print multiple result of same variable in textbox?

Posted By: Pawan kumar Shukla     Posted Date: December 30, 2010    Points:2   Category :Windows Application
what else i can use insted of textbox and how

my code is:

private void button1_Click(object sender, EventArgs e)
{
int i;
int result;
int num = Int32.Parse(textBox1.Text);
for (i = 1; i <= 10; i++)
{
result = num * i;
string stb= Convert.ToString(result);
textBox2.Text = stb;



}
}


it is showing last result only.



Responses
Author: Karthikeyan Anbarasan       [Moderator]      
Posted Date: January 01, 2011     Points: 5   

Declare the variable stb as public and then append the string. it will fix the issue.

stb += Convert.ToString(result);


Thanks
Karthik
http://www.f5debug.net
Mark as Answer if the answer solves your issue!!!
Author: Pawan kumar Shukla             
Posted Date: January 01, 2011     Points: 5   

hi,
karthik

can u write me the code coz i was trying but its not working

Author: Karthikeyan Anbarasan       [Moderator]      
Posted Date: January 01, 2011     Points: 5   

Try this code


string strstb;
private void button1_Click(object sender, EventArgs e)
{
int i;
int result;
int num = Int32.Parse(textBox1.Text);
for (i = 1; i <= 10; i++)
{
result = num * i;
strstb += Convert.ToString(result);

}
textBox2.Text = strstb;
}

Thanks
Karthik
http://www.f5debug.net
Mark as Answer if the answer solves your issue!!!


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