Home Forums WinForms controls Xceed Grid for WinForms Does anyone know the equivilent to DisplayMember? Reply To: Does anyone know the equivilent to DisplayMember?

User (Old forums)
Member
Post count: 23064

The DisplayFormat property sets what is displayed in the TextBox of the ComboBox. To set what is displayed in the Dropdown, you need to set Visible property of each column.

e.g. :
<i>
winComboBox1.DataSource = dataSet11;
winComboBox1.DataMember = “Products”;
winComboBox1.DisplayFormat = “%ProductName%”;
winComboBox1.ValueMember = “ProductID”;

winComboBox1.DropDownControl.Columns[ “CategoryID” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “Discontinued” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “ProductID” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “QuantityPerUnit” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “ReorderLevel” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “SupplierID” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “UnitPrice” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “UnitsInStock” ].Visible = false;
winComboBox1.DropDownControl.Columns[ “UnitsOnOrder” ].Visible = false;
</i>
This is required because the DropDownControl is in fact a grid.

You can also use the designer to do all this.

Imported from legacy forums. Posted by André (had 3007 views)