Deriving combobox
-
Ok.. here's what I'm trying to do I have a windows form (VB.NET) with a datagrid that display the content of a table in a database. (let's say countries for example) I can edit, delete and add records in this grid. In another windows form, I have a combobox. This combobox displays all countries. I want to add an item in this combobox (Add a country) and when I select it, I have to show the first form to allow the user to add, edit, delete countries and then select one. All changes applied in the grid have to be applied in the combobox and the (Add a country) item must not appear in the grid. How can I add an item manually in the combobox when this one is binded to a datasource? I don't know if it's possible, but if it is, if someone could send me some tips, I would appreciate! Thanks Marc
-
Ok.. here's what I'm trying to do I have a windows form (VB.NET) with a datagrid that display the content of a table in a database. (let's say countries for example) I can edit, delete and add records in this grid. In another windows form, I have a combobox. This combobox displays all countries. I want to add an item in this combobox (Add a country) and when I select it, I have to show the first form to allow the user to add, edit, delete countries and then select one. All changes applied in the grid have to be applied in the combobox and the (Add a country) item must not appear in the grid. How can I add an item manually in the combobox when this one is binded to a datasource? I don't know if it's possible, but if it is, if someone could send me some tips, I would appreciate! Thanks Marc
-
pls explain ur problem. do u want to add it at run time. (why can't u add it by addItem method) Arvi
It seems impossible to add an item in the combobox (using the AddItem method) when it's bound to a datasource. (And I talk about System.Windows.Form.Combobox here... I know it's possible with the dropdownlist in asp.net) ... I want to override some methods in the combobox to allow me to add the item manually at runtime after the datasource have been affected to the combobox. Marc
-
It seems impossible to add an item in the combobox (using the AddItem method) when it's bound to a datasource. (And I talk about System.Windows.Form.Combobox here... I know it's possible with the dropdownlist in asp.net) ... I want to override some methods in the combobox to allow me to add the item manually at runtime after the datasource have been affected to the combobox. Marc
I think it might be easier to do 1 of two things: 1) add the "Add A Country" to the DataSource before you bind them. For instance, get the DataSet of all countries, add the new blank country to the top of the DataSet ( or whereever ) with the NewRow and Insert methods, and then set it as the ComboBox's DataSource 2) simply add a button to the form that opens the Country-editor form. Maybe you could make the control's label a "link" or something.