Page 1 of 1

Counting records in C#

Posted: Sun Apr 29, 2012 4:52 am
by hortencio
I would like to creat a label where would be shown the number of each record i save. Is there any cod for doing so?

Re: Counting records in C#

Posted: Sun Apr 29, 2012 8:48 pm
by mandai
You could increment a counter each time a record is saved. The code would depend on what you are saving.

Re: Counting records in C#

Posted: Mon Apr 30, 2012 2:41 am
by hortencio
I found this method to count the records, but when it donsĀ“t keep the previous records.

this is a code:

comboBox1.Items.Add(codeTextBox.Text)
label5.Text = comboBox1.Items.Count.ToString();

Re: Counting records in C#

Posted: Tue May 01, 2012 12:04 am
by mandai
If you are storing your records in a combobox then you can just check how many items are in the list.