Resolved Add Text to datagridview button

kpgraci

Active member
Joined
Feb 21, 2011
Messages
30
Location
New Orleans
Programming Experience
10+
I have a datagridview that is bound to a dataset

I added a select button to the grid that is not bound, and I want to add text to it, like 1,2,3,...etc

So the text on the button will not come from the database.

I think I want to gain control when the row is being added (during binding) so I can access the button and change it's text property,
or there may be another way to do this...

How can I do this?

thx
 
Last edited:
Resolved

Think I got it...

VB.NET:
    Private Sub PatientDataGridView_RowsAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles PatientDataGridView.RowsAdded
        Dim o As DataGridViewButtonCell
        For index As Integer = e.RowIndex To e.RowIndex + e.RowCount - 1
            o = PatientDataGridView.Rows(index).Cells(0)
            o.Value = "F" & (index + 1).ToString
        Next
    End Sub
 
Back
Top