if (textBox1.Text != "" || textBox1.Text != "")
{
if (!listBox1.Items.Contains(textBox1.Text))
{
listBox1.Items.Add(textBox1.Text);
textBox1.Text = "";
}
I can add items to listbox by above code,
but i am not getting how to add exact number of items to listbox through textbox, For eg: i want to add only 7 items in listbox, if i try to add 8th item it should not take it. i know its normal question but i m new in C# could someone please help me.

Munesh SharmaPosted Oct 14, 2014, 3:19 AM
if (ListBox1.Items.Count > 10)
{
messageBox.show("limit is greater then 10");
}
else
{
ListBox1.Items.Add(TextBox1.Text)
}
raju patilPosted Oct 14, 2014, 4:32 AM
raju patilPosted Oct 14, 2014, 3:13 AM
Munesh SharmaPosted Oct 14, 2014, 1:42 AM
listbox1.IntegralHeight=false;
listbox1.Height=some_int_number;