Link to home
Start Free TrialLog in
Avatar of partulu
partulu

asked on

Trouble viewing the items in the listbox in Windows form application

I am having trouble with displaying items in a listbox. I am using the following code in Visual Studio.Net 2003 for a windows form application

  private void button1_Click(object sender, System.EventArgs e)
            {
                  
                        
                        
                        listBox1.Items.Add(textBox1.Text);
                        
                  
            }

When I keep on pressing the button the text gets added to the list box ( as it is know by the movement of the scroll bar in the list box) but the items in list box are not visible. I have made sure that property visible of listbox is set to true. Still, i am unsuccessful

Can anyone please reply to my question

Thanks
Avatar of AaronReams
AaronReams

This should work.  Set a breakpoint on the line and check the value of textBox1.Text in debug mode by hovering over it with the mouse or looking in the watch window.  Make sure textBox1.Text != "".

Hope this helps.  Cheers -Aaron
ASKER CERTIFIED SOLUTION
Avatar of jatinderalagh
jatinderalagh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial