Hi,
I am introducing myself to VB.NET by converting a fairly simply Access application to Windows Forms VB.NET as a learning exercise.
So far I have:
I created a datasource and dragged it to the form in details mode (using the Access DB as the underlying source).
Rearranged the fields etc.
Modified the AddNew event of the navigator to set up some default values when a new record is added.
Added Tool Tips for the data fields.
Now I want a manually created (fixed values) list box/Drop Down with values like E.g. A Apple, B Ball, C Cat etc. where "C" is the code linked to the database field and Cat is the value in the drop down list. So if the column for the current record contains a C, Cat will be displayed in the drop down list but when I select Ball, and update by say clicking on the Save icon, the B will now be stored in the column.
I have looked for a simple answer to what should be a simple problem (in my mind at least) and there are lots of answers but none I have found that addresses this basic example.
In Access it is easy "A;Apple;B;Ball;C;Cat" etc. and tell Access what the column is in the DB and that Column 0 is the one to map etc.
It is also easy in Delphi (probably a dirty word here![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I suspect it has something to do with the SelectedIndex, SelectedItem, SelectedIndex datasource items (and perhaps the Items Collection) but cannot see to work out the right format to use?
Note: There must be a way to do this would needing to build a special lookup table in a database, right?
Thanks in Advance,
James
I am introducing myself to VB.NET by converting a fairly simply Access application to Windows Forms VB.NET as a learning exercise.
So far I have:
I created a datasource and dragged it to the form in details mode (using the Access DB as the underlying source).
Rearranged the fields etc.
Modified the AddNew event of the navigator to set up some default values when a new record is added.
Added Tool Tips for the data fields.
Now I want a manually created (fixed values) list box/Drop Down with values like E.g. A Apple, B Ball, C Cat etc. where "C" is the code linked to the database field and Cat is the value in the drop down list. So if the column for the current record contains a C, Cat will be displayed in the drop down list but when I select Ball, and update by say clicking on the Save icon, the B will now be stored in the column.
I have looked for a simple answer to what should be a simple problem (in my mind at least) and there are lots of answers but none I have found that addresses this basic example.
In Access it is easy "A;Apple;B;Ball;C;Cat" etc. and tell Access what the column is in the DB and that Column 0 is the one to map etc.
It is also easy in Delphi (probably a dirty word here
I suspect it has something to do with the SelectedIndex, SelectedItem, SelectedIndex datasource items (and perhaps the Items Collection) but cannot see to work out the right format to use?
Note: There must be a way to do this would needing to build a special lookup table in a database, right?
Thanks in Advance,
James