GJJ
GJJ

Reputation: 494

Displaying number of elements inside an array list with a messagebox

I have an array list called str, i want to see how many elements there are inside that array list, how should I go about using a messagebox to display that?

Upvotes: 0

Views: 1892

Answers (4)

Asad Iqbal
Asad Iqbal

Reputation: 304

MessageBox.Show(str.Count.ToString());

Upvotes: 0

FIre Panda
FIre Panda

Reputation: 6637

Try

ArrayList arr = new ArrayList();
......
MessageBox.Show(arr.Count.ToString());

Upvotes: 0

manji
manji

Reputation: 47978

ArrayList.Count:

MessageBox.Show(string.Format("str: {0} element(s)", str.Count));

Upvotes: 3

anishMarokey
anishMarokey

Reputation: 11397

you can just do for getting the length and display it .

MessageBox.Show(str.Count.ToString());

Upvotes: 4

Related Questions