Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bind Checkbox

Status
Not open for further replies.

djj55

Programmer
Joined
Feb 6, 2006
Messages
1,761
Location
US
Hello, how do I bind a check box to a data set? I have:
Code:
Dim gCONNSTRING As String = "DSN=MyDSN;"
Dim gDBCONN2 As New Odbc.OdbcConnection(gCONNSTRING)
gDBCONN2.Open()
oCommand.Connection = gDBCONN2
strSQL = "SELECT * FROM mySQLTable"
oCommand.CommandText = strSQL
oAdapter.SelectCommand = oCommand
oAdapter.Fill(ds_User, "UserInfo")
Me.cbo_Associate.DataSource = Me.ds_User.Tables("UserInfo")
Me.cbo_Associate.DisplayMember = "Associate"
Me.txt_UserName.DataBindings.Add(New Binding("Text", Me.ds_User.Tables("UserInfo"), "UserName"))
[b]Me.chk_Active.DataBindings.Add(New Binding("Bit", Me.ds_User.Tables("UserInfo"), "myBitColumn"))[/b]
works fine until the last line. It does not like Bit, Boolean, or Text.

Thank you for any help/ideas
djj
 
Bind to the Checked property of the checkbox, since that is what you want to happen:


Me.chk_Active.DataBindings.Add(New Binding([red]"Checked"[/red], Me.ds_User.Tables("UserInfo"), "myBitColumn"))

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Now it makes sence. I was thinking value type not Property Name, even though that is what it clearly states.

Thanks for the assistance
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top