|
-
Dec 8th, 2003, 03:01 PM
#1
Thread Starter
Fanatic Member
Dynamic Databindings
I have a combo box that lists 2 tables. When a table name is selected, a datagrid's datasource is then set and the datagrid is populated with the respecitve table's data. My question is, what is the best way to link (databind) a label's text property to the current position's value for a certain field? For example, if there is an ID field in the table and the table has 3 records and each record's ID values are as follows:
Record 1 (position 0) ID='A'
Record 2 (position 1) ID='B'
Record 3 (position 2) ID='C'
When I click in the datagrid, I want my label to reflect the current position's value, so if I click in record 2 (position 1), I want my label to say 'B' etc.
What is the best way to accomplish this?
THanks!
-
Dec 8th, 2003, 07:20 PM
#2
Addicted Member
I haven't needed to do this before myself, but the best way to do it would be to get the ASCII code for "A". And add to it based on the row index. ie if the row index is 0 then it will return "A", if the row index is 3 then it will return "D".
I haven't worked with ascii for a while, so I can't remember how to get/set characters based on the ASCII value, but there is information on it out there, and I'm sure one of the guys here will be able to tell you.
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
|