Home Forums WinForms controls Xceed Grid for WinForms How to display "yes" or "no" instead of boolean in vb Reply To: How to display "yes" or "no" instead of boolean in vb

User (Old forums)
Member
Post count: 23064

“Well I am having some problems for making a column display “Yes” or “No” instead of 1 or 0.”

Like Tommy wrote, you could use a Xceed.Grid.Editors.GridComboBox as cell viewer:

Like this (C#):

ArrayList refTypeAL = new ArrayList(); //Used to display in a combo
refTypeAL.Add(new DictionaryEntry(“1”, “Yes”));
refTypeAL.Add(new DictionaryEntry(“0”, “No”));

Xceed.Grid.Editors.GridComboBox status_comboEditor = new Xceed.Grid.Editors.GridComboBox();
Xceed.Grid.Editors.GridComboBox status_comboViewer = new Xceed.Grid.Editors.GridComboBox();

status_comboEditor.DataSource = refTypeAL;
status_comboEditor.ValueMember = “Key”;
status_comboEditor.DisplayMember = “Value”;
status_comboEditor.DropDownWidth = 400;
status_comboEditor.TabStop = false;

status_comboViewer.DataSource = refTypeAL;
status_comboViewer.ValueMember = “Key”;
status_comboViewer.DisplayMember = “Value”;
status_comboViewer.DropDownWidth = 400;
status_comboViewer.TabStop = false;

gridControl1.Controls.Add(status_comboViewer);
status_comboViewer.Location = new System.Drawing.Point(-1000,-1000);

gridControl1.Columns[ “Test1” ].CellEditor = status_comboEditor;
gridControl1.Columns[ “Test1” ].CellViewer = new ControlViewer( status_comboViewer, “SelectedValue” );

Regards
Thomas

Imported from legacy forums. Posted by C# (had 398 views)