Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set DataGridViewButtonCell Text In A Column with Multiple Controls
    text
    copied!<p>I have a DataGridViewTextBoxColumn that holds different types of DataGridViewCells (Combobox, Text &amp; Button).</p> <p><img src="https://i.stack.imgur.com/25QBo.png" alt="Different DataGridView Cells"></p> <p>Here is how I build the datagridview rows:</p> <pre><code>Public Shared Function BuildDgvRow(ByVal tq As clsTabsQuestion) As DataGridViewRow Dim Row As New DataGridViewRow Dim ComboBoxCell As New DataGridViewComboBoxCell Dim CellBtn As New DataGridViewButtonCell //File Upload Dim CellTxtQ As New DataGridViewTextBoxCell //Cell question Dim CellTxt As New DataGridViewTextBoxCell //Cell txt CellTxtQ = New DataGridViewTextBoxCell //Build row With Row //Add cell that will contain question .Cells.Add(CellTxtQ) //Add CheckBox / Button / Text to the other cell that will contain the answer Select Case tq.sType Case "YesNo" ComboBoxCell = New DataGridViewComboBoxCell() ComboBoxCell.Items.AddRange(New String() {"Yes", "No", "N/A"}) .Cells.Add(ComboBoxCell) Case "FileUpload" CellBtn = New DataGridViewButtonCell .Cells.Add(CellBtn) Case "Text" CellTxt = New DataGridViewTextBoxCell .Cells.Add(CellTxt) End Select //Set row values .SetValues({tq.Title, ""}) .Tag = tq End With Return Row End Function </code></pre> <p>I cannot seem to get any "Text" property from the DataGridViewButtonCell class. Is there a way to set text on a DataGridViewButtonCell? This is a questionnaire and users are able to create their own. Therefore they have a choice to choose a combobox, text or button as an answer to their question. </p> <p>Is what I'm trying to do possible?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload