Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
place ultraComboEditor on a Panel
posted

Hi ,

I have a comboBox that has three options i.e TextBox , ComboxBox , UltraComboEditor ( with check boxes). Depending on what the user clicks , that control should be displayed ontop of a Panel in a Table Layout Panel. I am achieving this using if else and setting Visible property to true for one of them and false for the other two.

The text box and combobox get displayed when i choose the respective option but UltraComboEditor doesnt get displayed . Initiailly I keep all of their visibily to false . Then I go changing based on user selection.

My problem is that my UltraComboEditor never seems to be displayed. Heres some code :

private void Form1_Load(object sender, EventArgs e)
{

this.ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
this.ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft;

}

private void comboBox3_SelectionChangeCommitted(object sender, EventArgs e)
{
ReplaceComponent((ComboBox) sender, comboBox8, textBox3,ultraComboEditor3);

}

private void ReplaceComponent(ComboBox sender,ComboBox c,TextBox t,UltraComboEditor u)
{
if (sender.SelectedItem.ToString() == "ComboBox")
{
c.Items.Clear();
c.Items.Add("");
c.Items.Add("ASA");

c.Visible = true;
t.Visible = false;
u.Visible = false;
}
else if (sender.SelectedItem.ToString() == "UltraComboEditor")
{
u.Items.Clear();
u.Items.Add("Black Oil");
u.Items.Add("Dry Gas");
u.Items.Add("Gas Cond");
u.Items.Add("Heavy Oil");
u.Items.Add("Volatile Oil");


u.Visible = true;


t.Visible = false;
receiver.Visible = false;
}
else if (sender.SelectedItem.ToString() == "TextBox")
{

u.Visible = false;


t.Visible = true;
receiver.Visible = false;

}

Only other way i can do this is by passing the panel and clearing all contorls and adding the one I want .

Parents Reply Children
No Data