• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 806
  • Last Modified:

Change DataGridViewButtonColumn Text

Can someone tell me if it is possible to change the text on a DataGridViewButtonColumn if the table has a datasource.  I am using the following code and it does nothing.  I do have the UseColumnTextForButtonValue set to true.

        For i As Integer = 0 To DataGridView1.RowCount - 1
            DataGridView1(0, 1).Value = "ReAssign"
        Next
0
pat_cunningham
Asked:
pat_cunningham
  • 5
  • 3
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
Change it to this

For i As Integer = 0 To DataGridView1.RowCount - 1
   DataGridView1(0, 1).Value = "ReAssign"
Next
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Sorry

For i As Integer = 0 To DataGridView1.RowCount - 1
   DataGridView1(0, i).Value = "ReAssign"
Next
0
 
pat_cunninghamAuthor Commented:
I am sorry that is what I had. I changed the i to a 1 to see if I could get any of the text to change.  There are actually about 10 rows in this table.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Jorge PaulinoIT Pro/DeveloperCommented:
But the DataGridViewButtonColumn  is unbound right ?
0
 
pat_cunninghamAuthor Commented:
yep
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
>> I do have the UseColumnTextForButtonValue set to true

I miss that! Do not use this. Change UseColumnTextForButtonValue = False and try the code.
0
 
pat_cunninghamAuthor Commented:
thanks for the help.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Thanks for the grade!

Good work
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now