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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBGrid and Buttons

Status
Not open for further replies.

treyball3

Programmer
Jun 20, 2001
74
US
I have a dbgrid control, with one column containing a button (this is the button from the dbgrid properties of the column). The column is a text field that contains either "Yes" or "No". When the user clicks the button, it will toggle it to the opposite of what is in the cell. In my grid, however, it only works on the first cell that I click it on. I get the little editing pencil in the left margin, but then it doesn't go away and I can't change any other values. Any idea what's going on?

Here's my code...

Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
If DBGrid1.Columns(ColIndex) = "Yes" Then
DBGrid1.Columns(ColIndex) = "No"
ElseIf DBGrid1.Columns(ColIndex) = "No" Then
DBGrid1.Columns(ColIndex) = "Yes"
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top