开发者

checkbox in datagrid a field in sql table if true i need that check box to be checked

Hi I am Mukesh from Madurai

I am using a VB.Net form in which I have a table of sql. In it is a boolean field.

I want to show this field in a form as checked if that field value is true and if false then it should not be开发者_如何学JAVA checked. Is this is possible?

If possible please help me with the code which I have to type to make that column in the datagrid view to checked or not.

I have created the sql inside vb.net using add new item and then a database.


First, as you probably have already done, you'll need to import your database. Then set up your data source so you can reference it in code. If you don't know how to do these things, you'll need to look them up on MSDN or the like. They're pretty straightforward. (I wouldn't recommend asking a stackoverflow question to learn how to do these, as you'll probably just get a link as an answer anyway.)

Once you've gotten your database set up, you should be able to tie the checked/unchecked state of a check box (which is what I think you're referring to) to the value using a very simple code similar to the following:

CHECKBOX.Checked = DATABASE_BOOLEAN_FIELD

Replace "CHECKBOX" with the name of your checkbox, and "DATABASE_BOOLEAN_FIELD" with the reference to your database's boolean field.

So, as a recap, you'll need to do the following steps. From experience, I can tell you that one of the best ways to get better with programming is to follow a step-by-step, using your own knowledge and research skills to figure out each step.

  1. Import database into your VB.net project.
  2. Create data source.
  3. Set checkbox's "checked" property to the boolean field in your data source.

After you've earnestly tried this, if you're still stumped, I can walk you through it in a little more detail. Just comment on my answer (and edit your question to include what code you've written for this so far) for more help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜