I have ToolStripButton1.Click, when I click on it, the row is added. I don’t want this to happen
See the problem here
thank
Public Class Form2
Dim myTable As New DataTable()
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
myTable.Columns.Add("Name")
DataGridView1.DataSource = myTable
DataGridView1.AllowUserToAddRows = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'No Problem
DataGridView1.AllowUserToAddRows = Not DataGridView1.AllowUserToAddRows
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
'But This Event Problem?
DataGridView1.AllowUserToAddRows = Not DataGridView1.AllowUserToAddRows
End Sub
End Class
I want to set the AllowUserToAddRows variable true or false with the ToolStripButton1.Click event