Can't set value of datagridview cell

Can't set value of datagridview cell

The documentation claims you can set the cell value thusly:

Private Sub SetCellValue(ByVal myGrid As DataGrid)
   Dim myCell As New DataGridCell()
   ' Use an arbitrary cell.
   myCell.RowNumber = 1
   myCell.ColumnNumber = 1
   ' Change the cell's value using the CurrentCell.
   myGrid(myCell)= "New Value"
End Sub

            MsgBox("new row index " & Me.DataGridView1.NewRowIndex.ToString)
            MsgBox("rowcount " & Me.DataGridView1.RowCount.ToString())
gives me the respective messages 0 and 1 respectively.  I might add that the datagridview is unbound and without a datasource.           

          Dim aCell As New DataGridView1cell gives me the message datagridview1cell is not defined.

Further in the documentation are examples.  I adapted the examples

           Dim rowArray As String()
          
           
'Dim row1() As String = {"Meatloaf", "Main Dish", "ground beef", "**"}
 to
Dim row1 As String = {Me.WATopicID.ToString(), Me.KeywordSetTextBox.Text, " "}

The questionmark is because the example is for all columns as textboxes.  Nowhere did I find documentation on how to fill a row with other controls as columns, particularly a checkbox.

    Dim rowArray As String()
    For Each rowArray In rows
        dataGridView1.Rows.Add(rowArray)
    Next rowArray
   
However, rows is undeclared. It seems the documentation is behind the current implementation of the beta framework.

Can somebody help me

You might ask why I don't add a datasource for the keywords grid Because I have thousands of keywords.  It's easier to just execute an insertquery to the tableadapter and not have to drain a large amount of resources and slow the user experience considerably.

dennist          



Answer this question

Can't set value of datagridview cell