We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ComboBox

Dear Sir/Madam, I copied this code from gotdotnet.com tutorial. //it is adding items to a combobox1(cmbStyle) StringIntObject[] aStyle = new StringIntObject[3]; aStyle[0] = new StringIntObject("Simple",(int)ComboBoxStyle.Simple); aStyle[1] = new StringIntObject("Dropdown",(int)ComboBoxStyle.DropDown); aStyle[2] = new StringIntObject("Dropdownlist",(int)ComboBoxStyle.DropDownList); cmbStyle.Items.AddRange(aStyle); comboBegin.DropDownStyle = (ComboBoxStyle)aStyle[1].i; comboEnd.DropDownStyle = (ComboBoxStyle)aStyle[1].i; cmbStyle.SelectedIndex = 1; //This is adding items to a combobox2(cmbDrawMode) // Sync ComboBox draw modes to DrawMode.NORMAL StringIntObject[] aDMO = new StringIntObject[3]; aDMO[0] = new StringIntObject("Normal",(int)DrawMode.Normal); aDMO[1] = new StringIntObject("Ownerdrawfixed",(int)DrawMode.OwnerDrawFixed); aDMO[2] = new StringIntObject("Ownerdrawvariable",(int)DrawMode.OwnerDrawVariable); cmbDrawMode.Items.AddRange(aDMO); comboBegin.DrawMode = (DrawMode)aDMO[0].i; comboEnd.DrawMode = (DrawMode)aDMO[0].i; cmbDrawMode.SelectedIndex = 0; i get an error when i run the application saying are you missing an assembly directive please help.

1 Reply

AR Anupama Roy Syncfusion Team February 20, 2006 11:41 AM UTC

Hi Mahan, You need to define the class StringIntObject as shown below: public class StringIntObject { public string s; public int i; public StringIntObject(string sz, int n) { s=sz; i=n; } public override string ToString() { return s; } } Regards, Anu.

Loader.
Live Chat Icon For mobile
Up arrow icon