|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataBinding and Combo BoxesI am trying to create a form using databinding to a dataset and one of the
fields requires the user to select from a list of optons. Any hints on how to do this other than bind the field to a label or text box to display the current field value then add a combo box with the list of items to chose from? -- Dennis in Houston I'm sorry but I don't quite understand the question. Could you reword
it please, and I will do my best to answer it. (for standard binding to a combobox, known as "complex binding" for some bizarre reason...) mycombo.datasource = myDataTable ' or, myDataset.Tables(0) or myDataset.Tables("tablename") mycombo.DisplayMember = "DisplayField" ' whichever column you want to display in the combobox mycombo.ValueMember = "IDField" ' whichever column is the uniquely identifying column in a row. Dennis,
As Steven told, give us some more information, from this I cannot get only gues. As we are talking about databinding, than the datasource is important (bindingsource whatever). As well the properties we want to bind to. For about what you are talking is probably the dataview your first friend. Cor Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> schreef in bericht news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com... >I am trying to create a form using databinding to a dataset and one of the > fields requires the user to select from a list of optons. Any hints on > how > to do this other than bind the field to a label or text box to display the > current field value then add a combo box with the list of items to chose > from? > > -- > Dennis in Houston I have a form that is bound to a dataset. On it, there are some text box
controls and also a combo box that I want to display the current dataset row fields and let the user edit then save to the current dataset row being displayed. For the combo box, I want to display the current value of the field in the current DataSet Row and allow the user to change it by selecting a new value from a drop down list. I can add the allowable values to the combobox but can't seem to get the combobox to show the current field value using databinding. -- Show quoteHide quoteDennis in Houston "Cor Ligthert [MVP]" wrote: > Dennis, > > As Steven told, give us some more information, from this I cannot get only > gues. > > As we are talking about databinding, than the datasource is important > (bindingsource whatever). > > As well the properties we want to bind to. For about what you are talking is > probably the dataview your first friend. > > Cor > > > "Dennis" <Den***@discussions.microsoft.com> schreef in bericht > news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com... > >I am trying to create a form using databinding to a dataset and one of the > > fields requires the user to select from a list of optons. Any hints on > > how > > to do this other than bind the field to a label or text box to display the > > current field value then add a combo box with the list of items to chose > > from? > > > > -- > > Dennis in Houston > > > Dennis,
This sample is with a datagrid, (mainly to show the different ways of databinding) however it is mainly the same. As soon as you have databind something it is sticked to the current row. If you want to let them work independent, than you have to create seperate dataviews. http://www.vb-tips.com/default.aspx?ID=5f4a0f68-a3b6-4fc8-8aff-587f730fa118 A problem is that using the combobox textbox for operations seems for me one chain of bugs. I reported lately one for 2005. Also I have posted in past those in different newsgroups to see a reaction. I got the idea than the Combobox problems are a plague I have never got any reaction. However, I hope this helps, and otherwise reply. Cor Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> schreef in bericht news:4414EA7C-C03C-4E60-955D-F66389987E72@microsoft.com... >I have a form that is bound to a dataset. On it, there are some text box > controls and also a combo box that I want to display the current dataset > row > fields and let the user edit then save to the current dataset row being > displayed. > > For the combo box, I want to display the current value of the field in the > current DataSet Row and allow the user to change it by selecting a new > value > from a drop down list. I can add the allowable values to the combobox but > can't seem to get the combobox to show the current field value using > databinding. > > -- > Dennis in Houston > > > "Cor Ligthert [MVP]" wrote: > >> Dennis, >> >> As Steven told, give us some more information, from this I cannot get >> only >> gues. >> >> As we are talking about databinding, than the datasource is important >> (bindingsource whatever). >> >> As well the properties we want to bind to. For about what you are talking >> is >> probably the dataview your first friend. >> >> Cor >> >> >> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht >> news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com... >> >I am trying to create a form using databinding to a dataset and one of >> >the >> > fields requires the user to select from a list of optons. Any hints on >> > how >> > to do this other than bind the field to a label or text box to display >> > the >> > current field value then add a combo box with the list of items to >> > chose >> > from? >> > >> > -- >> > Dennis in Houston >> >> >> Thanks Cor. I suspected that it wasn't that easy to do with a dataset.
-- Show quoteHide quoteDennis in Houston "Cor Ligthert [MVP]" wrote: > Dennis, > > This sample is with a datagrid, (mainly to show the different ways of > databinding) however it is mainly the same. As soon as you have databind > something it is sticked to the current row. > If you want to let them work independent, than you have to create seperate > dataviews. > > http://www.vb-tips.com/default.aspx?ID=5f4a0f68-a3b6-4fc8-8aff-587f730fa118 > > A problem is that using the combobox textbox for operations seems for me one > chain of bugs. > I reported lately one for 2005. > > Also I have posted in past those in different newsgroups to see a reaction. > I got the idea than the Combobox problems are a plague I have never got any > reaction. > > However, I hope this helps, and otherwise reply. > > Cor > > > > "Dennis" <Den***@discussions.microsoft.com> schreef in bericht > news:4414EA7C-C03C-4E60-955D-F66389987E72@microsoft.com... > >I have a form that is bound to a dataset. On it, there are some text box > > controls and also a combo box that I want to display the current dataset > > row > > fields and let the user edit then save to the current dataset row being > > displayed. > > > > For the combo box, I want to display the current value of the field in the > > current DataSet Row and allow the user to change it by selecting a new > > value > > from a drop down list. I can add the allowable values to the combobox but > > can't seem to get the combobox to show the current field value using > > databinding. > > > > -- > > Dennis in Houston > > > > > > "Cor Ligthert [MVP]" wrote: > > > >> Dennis, > >> > >> As Steven told, give us some more information, from this I cannot get > >> only > >> gues. > >> > >> As we are talking about databinding, than the datasource is important > >> (bindingsource whatever). > >> > >> As well the properties we want to bind to. For about what you are talking > >> is > >> probably the dataview your first friend. > >> > >> Cor > >> > >> > >> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht > >> news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com... > >> >I am trying to create a form using databinding to a dataset and one of > >> >the > >> > fields requires the user to select from a list of optons. Any hints on > >> > how > >> > to do this other than bind the field to a label or text box to display > >> > the > >> > current field value then add a combo box with the list of items to > >> > chose > >> > from? > >> > > >> > -- > >> > Dennis in Houston > >> > >> > >> > > >
Datagrid problem
Doing some extra task while saving databind Controls in VB.Net 2005 ? select all text when textbox1 is clicked Auto-stop DUN via VB.Net? Dynamically Loading Programs Adding HTML code to project. SQL Server and ADO.Net best method Oledb VS Sql. Oledb works with Sql Server; Sql doesn't...why Problems with TCP Listener Error when trying to create new SQL Server login via ado.Net |
|||||||||||||||||||||||