How do I set the DataBindings for a LookupBox?
I want to see the datafield "label" in the lookupBox and get the datafield "id" for the selected value
my query looks like "select * from [Enumeration-View]"
Is there an example?
I am using version 2006.4
DataBindings for a LookupBox
DataBindings for a LookupBox
Are you talking about a ComboBox on a Form?
If you you can access the underlying control using the "Control" property.
for example, if you have a comboBox1 control on the form you can set the datasource to a DataTable
comboBox1.Control.DisplayMember = "label";
comboBox1.Control.ValueMember = "id";
comboBox1.Control.Datasource = myData;
If you you can access the underlying control using the "Control" property.
for example, if you have a comboBox1 control on the form you can set the datasource to a DataTable
comboBox1.Control.DisplayMember = "label";
comboBox1.Control.ValueMember = "id";
comboBox1.Control.Datasource = myData;
DataBindings for a LookupBox
Thanks for your answer!
I have a Form in my Report with a LookupBox. I want to display there values from a datasource from the dictionary called Enumeration. This DataSource get the values from the database with a sql query ("Select * from [Enumeration-View]"). In the LookupBox I want display values from the datafield called "label" with underlying datafield "id".
In the properties of the LookupBox I set the databindings for Text to datafield "label" and for Keys to datafield "id".
When I render the report to the preview-window the Form comes up but the LookupBox does not display any values/rows.
I have a Form in my Report with a LookupBox. I want to display there values from a datasource from the dictionary called Enumeration. This DataSource get the values from the database with a sql query ("Select * from [Enumeration-View]"). In the LookupBox I want display values from the datafield called "label" with underlying datafield "id".
In the properties of the LookupBox I set the databindings for Text to datafield "label" and for Keys to datafield "id".
When I render the report to the preview-window the Form comes up but the LookupBox does not display any values/rows.
DataBindings for a LookupBox
Hi Scotty,
If you have already registered a Datasource to the Dictionary then in your FormLoad code in the stimulReport Form you can try this:
ComboBoxControl1.Control.DisplayMember = "label";
ComboBoxControl1.Control.ValueMember = "id";
ComboBoxControl1.Control.DataSource = this.Dictionary.DataSources["Enumeration"].DataTable;
where:
ComboBoxControl1 is the name of your LookupBox
and this.Dictionary.DataSources["Enumeration"] is the name of your DataSource in the dictionary.
Regards,
Brendan.
If you have already registered a Datasource to the Dictionary then in your FormLoad code in the stimulReport Form you can try this:
ComboBoxControl1.Control.DisplayMember = "label";
ComboBoxControl1.Control.ValueMember = "id";
ComboBoxControl1.Control.DataSource = this.Dictionary.DataSources["Enumeration"].DataTable;
where:
ComboBoxControl1 is the name of your LookupBox
and this.Dictionary.DataSources["Enumeration"] is the name of your DataSource in the dictionary.
Regards,
Brendan.
DataBindings for a LookupBox
Thanks
This works fine, now I see the all the values, but when i select one of the values in the lookupbox I get an error:
Method: [get_Item]
Der Index liegt außerhalb des gültigen Bereichs. Der Index darf keine negaitve Zahl und muss kleiner als die Auflistungsgröße sein.
Parametername: index.
in englisch:
Index out of range. index must be positive and less than the number of entries in the list
parameter: index
Please help
This works fine, now I see the all the values, but when i select one of the values in the lookupbox I get an error:
Method: [get_Item]
Der Index liegt außerhalb des gültigen Bereichs. Der Index darf keine negaitve Zahl und muss kleiner als die Auflistungsgröße sein.
Parametername: index.
in englisch:
Index out of range. index must be positive and less than the number of entries in the list
parameter: index
Please help
DataBindings for a LookupBox
And you also may use a LookUpBoxControl in the following way.
Please set lookUpBox.Keys and lookUpBox.SelectedKey to the key value of your DataSource.
lookUpBox.Items should be set to the result value of your DataSource.
After that result of the user choice you may get in the following properties:
Result value - lookUpBox.SelectedItem
Key value - lookUpBox.SelectedKey
Thank you for the cooperation.
Please set lookUpBox.Keys and lookUpBox.SelectedKey to the key value of your DataSource.
lookUpBox.Items should be set to the result value of your DataSource.
After that result of the user choice you may get in the following properties:
Result value - lookUpBox.SelectedItem
Key value - lookUpBox.SelectedKey
Thank you for the cooperation.