Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
who can help please?
I have a listbox with some names (datasource is assigned in code)

listbox1
Gery
Tom
Bob
Alisa
Madona
Dreni
Meni
Geni

so how can i use another list or for exampl when I clik in a button that show me only first four members in listbox... that list should be also like MessaggeBox

so in messagge box or another listbox that be only the first four member like:
Gery
Tom
Bob
Alisa


thnx
Posted

1 solution

try this :
C#
string msg = string.Empty;
for(int i=0;i<4;i++)
{
    msg+=(string)listbox1.Items[i] + "\n";
}
MessageBox.Show("The first four items :\n" + msg);
 
Share this answer
 
Comments
h5h5 11-May-12 4:54am    
Thnx man :) It works
God bless you !

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