-
Dec 28th, 2017, 01:02 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Combobox not showing databound collection
I am using the following code for displaying table data in controls on a form:
Code:
txtOwner.DataBindings.Add(New Binding("Text", _MasterBase5_0DataSet, "tblValMaster.strOwner"))
I do not fully understand the workings of this, so when the control is a combobox and it doesn't work correctly I am pretty much unable to explain why.
Code:
With cmbType
.DataBindings.Add(New Binding("ValueMember", _MasterBase5_0DataSet, "lkpValType.strValType"))
.DataBindings.Add(New Binding("DisplayMember", _MasterBase5_0DataSet, "lkpValType.strValType"))
.DataBindings.Add(New Binding("Text", _MasterBase5_0DataSet, "tblValMaster.strValType"))
End With
The "Text" part of the above code behaves as expected. However, the "ValueMember" and "Display" member do not. Nothing shows from either of them. I suspect that it has something to do with the fact that it is the, "Binding" that causes the behavior.
lkpValType is a lookup table that serves in the place of a collection that might be found in a combobox. So what should be showing is the list from table lkpValType.
Can anyone explain to me what I am doing wrong here?
-
Dec 28th, 2017, 01:41 PM
#2
Re: Combobox not showing databound collection
Dont add databinding, instead add datasrouce
IE
Code:
With ComboBox1
.DataSource = CatagoryDV
.DisplayMember = "Col1"
.ValueMember = "Col1"
End With
-
Dec 28th, 2017, 02:29 PM
#3
Thread Starter
Fanatic Member
Re: Combobox not showing databound collection
Thanks KP, that works perfectly. Using form controls for different binding sources at different times is a new thing for me and I still do not understand all of the ways and means of doing so.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|