Dear Kevin,
I did what you say but my new column has no values in its cells. It says is
databounded and the datapropertyname is right, but all cells are empty with a
value of Nothing...
I have:
myDGV.DataSource = my DataTable
'Since I want to change an existing column I call a sub as
ChangeToButton("MyColumn")
The ChangeToButton Sub is:
Private Sub ChangeToButtonColumn(ByVal strColumnName As String)
Dim buttons As New DataGridViewButtonColumn()
With buttons
.Name = strColumnName
.HeaderText = strColumnName
.DataPropertyName = strColumnName
'strColumnName is "MyColumn", which is a fields in MyTable the datasource
for MyDGV
.UseColumnTextForButtonValue = True
.FlatStyle = FlatStyle.Standard
.DisplayIndex = 6
End With
' I get rid of the original column
MyDGV.Columns.Remove(strColumnName)
'I add the new column
MyDGV.Columns.Add(buttons)
End Sub
Can you tell me what I am doing wrong?
Thank you
--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
"Kevin Yu [MSFT]" wrote:
Hi Peter,
With the code I provided in my last post, we can add a column with buttons
to the DataGridView. Then we can check in the DataGridView.Columns to
remove the original column with textboxes.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."