in my application i have one combobox and button
when i click button it needs to generate a code like C001,C002,etc.
how to do this?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Khargesh RajputPosted Mar 26, 2015, 2:34 AM
Durga VelusamyPosted Mar 26, 2015, 3:49 AM
ok fine . if it textbox means how to give
comboBox1.Items.Add(strc00);
Jignesh TrivediPosted Mar 26, 2015, 3:35 AM
Are you developing desktop base application or web base application?
agree with above answer if you are developing desktop application
but approach is different when you use web application because web application is stateless and you have to maintain state by your self
hope this will help you.
Pankaj Kumar ChoudharyPosted Mar 26, 2015, 3:28 AM
string Str = "C00";
string Stm;
private void button1_Click(object sender, EventArgs e)
{
Num++;
Stm = Str + Num.ToString();
ComboBox1.Items.Add(Stm);
}
Durga VelusamyPosted Mar 26, 2015, 2:25 AM
Khargesh RajputPosted Mar 26, 2015, 2:09 AM
Pankaj Kumar ChoudharyPosted Mar 26, 2015, 2:05 AM
static int Num = 0;
string Str = "C00";
string Stm;
private void button1_Click(object sender, EventArgs e)
{
Num++;
Stm = Str + Num.ToString();
MessageBox.Show(Stm);
}
Ans will be:
C001
C002
C003
-
-
-
-
C0010