Populating a Winforms ComboBox with Csharp





-10
Date Submitted Fri. Jul. 14th, 2006 11:11 AM
Revision 1 of 1
Helper eriveraa
Tags .Net | CSharp
Comments 1 comments
Example that shows how to populate a winforms combobox with csharp. It uses Data Access blocks (SqlHelper).

private void PoblarComboPais()
{
        // Trae las sociedades correspondientes al paƬs
        Cursor.Current = Cursors.WaitCursor;
        // Conexion
        string cn = SqlOptions.ConnectionString();

        // DataReader
        this.cboPais.DataSource = SqlHelper.ExecuteDataset(cn,CommandType.Text , "SELECT * FROM MAE_PAIS").Tables[0];
        this.cboPais.ValueMember = "chrPais";
        this.cboPais.DisplayMember = "chrPaisNombre";

        //Puntero del mouse normal
        Cursor.Current = Cursors.Default;
}
 

Lalo Rivera

Comments

Comments Seperation of Concerns?
Fri. May. 25th, 2007 7:59 AM    Beginner Jax

Voting