Counting records in C#

Post your questions regarding programming in C# in here.
4 posts Page 1 of 1
Contributors
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

Counting records in C#
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?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Counting records in C#
mandai
You could increment a counter each time a record is saved. The code would depend on what you are saving.
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

Re: Counting records in C#
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();
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Counting records in C#
mandai
If you are storing your records in a combobox then you can just check how many items are in the list.
4 posts Page 1 of 1
Return to “General coding help”