Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get number of items in listbox

Tags:

c#

.net

listbox

In my program i took a listbox, in this listbox I added number of items.

Now I want to know how to get number of listbox items & show number of items in a textbox. when number of items is not fixed.

like image 739
user1563019 Avatar asked Aug 17 '12 22:08

user1563019


1 Answers

Let's say your listbox is called ListBox1 and textbox is TextBox1. Then the code you need is

TextBox1.Text = ListBox1.Items.Count.ToString();

Of course knowing your platform (WinForms, WebForms, Html etc.) would help a lot for a more accurate answer.

like image 138
M. Mennan Kara Avatar answered Sep 23 '22 20:09

M. Mennan Kara