lundi 23 novembre 2020

Databinding when data types are different

I have a DataGridview sourced from an Access database. When I choose a row in the DataGridview it populates the respective controls in the UI. This works great.

The UI has a series of checkboxes for usability purposes. My problem is the column in Access is not boolean. For example, when I add a record one checkbox says something like, "student is separated". When adding a record the field(column) in the database is entered as either separated or retained. This is because I export reports that would make no sense to the end user with "yes" or "no".

But I am completely lost doing this in reverse. That is to say, when I select a row that says "separated" in that column, the checkbox in the UI needs to be checked. I don't know how to do this, and I can't even find any posts describing what I am trying to do.

How can I make the checkbox show what I want when the source data isn't a boolean?

I would have no issue writing conditional statements to figure out the data, but since databinding is basically a one-click operation in the properties window, I'm not sure where I would place any conditionals.




Aucun commentaire:

Enregistrer un commentaire