Click here to Skip to main content
15,907,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two two text boxes t1 and t2

t1 has unique id
t2 is a name

when i click on a add button new user id is shown on t1
and enter name and press save button

and so on when ever i click on add button t1 is automatically incremented

io try alot but not clear
Posted
Updated 7-Aug-11 1:19am
v2
Comments
Monjurul Habib 7-Aug-11 9:30am    
clarify your question. its not organize.what is your problem / what you want to do?

It might be helpful,

C#
namespace UITest
{
    using System;
    using System.Windows.Forms;
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnIncrement_Click(object sender, EventArgs e)
        {
            textBox1.Text = IncrementedResult(textBox2.Text).ToString();
        }

        private Int32 IncrementedResult(string dataToParse)
        {
            int result;
            return Int32.TryParse(dataToParse, out result) ? ++result : result;
        }
    }
}


:)
 
Share this answer
 
Comments
RaviRanjanKr 7-Aug-11 15:54pm    
Nice Answer, My 5+
Mohammad A Rahman 7-Aug-11 17:17pm    
Thanks Ravi :)
On Save set t1 = Convert.ToInt(t1.text)++;.
 
Share this answer
 
Comments
Per Söderlund 8-Aug-11 2:44am    
You mean "t1.Text"?

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