M
Mark L. Breen
Hello Guys and Galls,
I use combos on my forms.
The code to initialise the combos is as follows
Dim dsPIDTypes As DataSet
dsPIDTypes = PartDB.GetPIDTypes ' Returns a dataset object
cboPIDType.DataSource = dsPIDTypes
cboPIDType.DisplayMember = "tlkpPIDType.PT_Type"
cboPIDType.ValueMember = "tlkpPIDType.PT_ID"
I then have an object that stores the data that is currently displayed on
the form, it stores the selected value from the combo's, ie,
mycombobox.SelectedValue
When the user clicks the add button, I make the text of the combo to be = ""
However when the user clicks cancel, I want to revert to the values that
were previously displayed.
For the text boxes, this is easy,
Me.txtDate = objFormData.Date
Me.txtQty = objFormData.Qty
But then I need to update the text displayed in the combo box.
I can easily do
Me.MyComboBox.SelectedValue = objForm.Product Id
but I want the combo box to display the matching Selected Text.
Is there a way to do this without having to write a query to filter for that
Product Id ??
I guess what I want is something like
Me.MyComboBox.Text = Me.MyComboBox.Text that corresponds to the selected
value
Any suggestions?
Marko
I use combos on my forms.
The code to initialise the combos is as follows
Dim dsPIDTypes As DataSet
dsPIDTypes = PartDB.GetPIDTypes ' Returns a dataset object
cboPIDType.DataSource = dsPIDTypes
cboPIDType.DisplayMember = "tlkpPIDType.PT_Type"
cboPIDType.ValueMember = "tlkpPIDType.PT_ID"
I then have an object that stores the data that is currently displayed on
the form, it stores the selected value from the combo's, ie,
mycombobox.SelectedValue
When the user clicks the add button, I make the text of the combo to be = ""
However when the user clicks cancel, I want to revert to the values that
were previously displayed.
For the text boxes, this is easy,
Me.txtDate = objFormData.Date
Me.txtQty = objFormData.Qty
But then I need to update the text displayed in the combo box.
I can easily do
Me.MyComboBox.SelectedValue = objForm.Product Id
but I want the combo box to display the matching Selected Text.
Is there a way to do this without having to write a query to filter for that
Product Id ??
I guess what I want is something like
Me.MyComboBox.Text = Me.MyComboBox.Text that corresponds to the selected
value
Any suggestions?
Marko