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 SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 11:19 PM EDT
if (ListBox1.Items.Count > 10)
{
messageBox.show("limit is greater then 10");
}
else
{
ListBox1.Items.Add(TextBox1.Text)
}
Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 9:42 PM EDT
listbox1.IntegralHeight=false;
listbox1.Height=some_int_number;
raju patil52 reputationPosted Oct 13, 2014, 11:13 PM EDT
raju patil52 reputationPosted Oct 14, 2014, 12:32 AM EDT