Hi all,
I'm struggling with what is probably a fairly basic problem. Have a WinToolbar with a combobox and a go button underneath that launches a new MDI child form. I'm trying to pass the selection in the combobox as to the child from on opening, but can't find seem to find the correct code i'm looking for. Combobox is called MobileComboBox and my code for the button is as follows;
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) {switch (e.Tool.Key) case "MobileNumberGo": // ButtonToolForm2 newMDIChild = new Form2(); newMDIChild.MdiParent = this; newMDIChild.Show();break; Trying to pass the value into Form2(xxx);Any help would be greatly appreciated.
{
}
Cheers,
Andrew
Apologies for the code formatting. Doesn't seem to work properly.
private void ultraToolmarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{switch (e.Tool.Key){
case "MobileNumberGo":Form2 newMDIChild = new Form2();newMDIChild.MdiParent = this;newMDIChild.Show();break;}}
Trying to pass the Combobox value as a String variable to Form2.
You must cast the e.Tool property to a ComboBoxTool. Then you can get the Text or Value properties to determine what is selected in the ComboBox.
Hi Mike,
Thanks for the reply. Going to sound really stupid and ask if you can provide me some code. Have gone through it so many times, and still can't seem to get it right. Brain is fried :P
Have just updated the code to what I think it should be. Code details as follows. Note that the coding is still within the case statement. Hoping that is correct;
Infragistics.Win.UltraWinToolbars.ComboBoxTool MobileNumberComboBox = e.Tool as Intragistics.Win.UltraWinToolbars.ComboBoxTool;
MessageBox.Show(MobileNumberComboBox.SelectedItem.ToString());
Running this code throws a NullReferenceException. The Value MobileNumberComboBox is the Key of the tool in the Toolbar.
Any help is much appreciated.
Thanks,Andrew