Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two text box one have value to increment and other one gives the amount to increment with and increment value is showen on listbox
i want when value is inserted to listbox each value must have "ERT" letters with it.

i tried following but it is effecting my incrementing of series

decimal j = Convert.ToDecimal(textBoxlist.Text);

Int64 k = Convert.ToInt64(textBoxQuantity.Text);

if (textBoxlist.Text.Length >15)
{

for (int i = 0; i < k; i++)
{
SerialListBox.Items.Add("ERT"+j + i + 1);
}

simply i want to add prefix of ERT to each list box item.
Posted
Comments
Tbone1983 5-Mar-13 2:25am    
I don't understand your question. Is it possible to add some additional information on what you are searching for?

1 solution

It is taking the "ERT" + j + i + 1 as a string value hence you end up with


ERT1001 when J = 10 and I = 0

to fix it change this line

SerialListBox.Items.Add("ERT"+j + i + 1);


to

SerialListBox.Items.Add("ERT"+j + (i + 1));


If I have missed your problem completley please let me know by explaining it further.
 
Share this answer
 

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