S
S
Sama Samsonov2017-02-02 13:34:13
visual studio
Sama Samsonov, 2017-02-02 13:34:13

How to display data in a checkbox in c#?

The database has a table with an id and a name field. The table has 30 entries.
How to display all entries in a loop in a checkbox?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ATauenis, 2017-02-02
@ATauenis

You just run a cycle through the base (the code is different for each base, so I can’t write what I can stupidly copy-paste here), drive the value of the desired field into the record into a variable of either bool type if you need to tick it, or string if you need to write text. Next, set the value of the desired checkbox property, CheckState or Text, equal to the value of the variable. In the case of CheclState, you need to convert the boolean value to the value of the net enumeration with a simple switch (it will not work directly to write true / false there), Text is written directly, as in a variable.
Then you can simplify the code by replacing the intermediate variable with a direct copy from the database to switch/.Text.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question