ListBox Items Add : ListBox : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » ListBox »

 

ListBox Items Add








    
using  System;
using  System.Drawing;
using  System.Windows.Forms;
using  System.Data;
using  System.Data.SqlClient;

public  class  ListBoxItemAdd  :  Form{
    ListBox  lb;

    public  ListBoxItemAdd()
    {
        Size  =  new  Size(300,400);

        lb  =  new  ListBox();
        lb.Parent  =  this;
        lb.Location  =  new  Point(10,10);
        lb.Size  =  new  Size(ClientSize.Width  -  20,  Height  -  200);
        lb.Anchor  =  AnchorStyles.Top  |  AnchorStyles.Left  |  AnchorStyles.Right  |  AnchorStyles.Bottom;
        lb.BorderStyle  =  BorderStyle.Fixed3D;


        lb.BeginUpdate();
        for  (int  i  =  0;  i  <  5;  i++)
        {
              lb.Items.Add(i);
        }            

        lb.Items.Add("12345");
        lb.Items.Add("67890");
        lb.EndUpdate();
    }  

    static  void  Main()  
    {
        Application.Run(new  ListBoxItemAdd());
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» ListBox