Loop not working
I have two text box
Textbox1and Textbox2 and button1
textbox1.text = 1;
textbox2.text = 0;
Now I want when I click on button1.textbox2's data increment. this is my code
for (int i = 0; i <= 5; i++)
{
textBox2.Text = textBox1.Text[i].ToString();
}
yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
On each button click you would like to increment it by 5?
Or what is that for loop there?
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
I am Retrieving Studentid from sql and show in textbox1.its Show right.but I want if textbox1's text is 10000data show of textbox1 after increment 1.
as a 10001.
Example
Textbox1 Loop Texbox2
10000 +1 10001
yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
Are you looking for something like this?
private void button1_Click(object sender, EventArgs e)
{
// augment txbox1 value and put in txbox2
int id =int.Parse(this.textBox1.Text);
++id;
this.textBox2.Text = id.ToString();
// if txbox1 contains 10001, txbox2 will now contain 10002
}
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661