Based on some suggestions I have received from this board, I am rewriting my program using a DataGridView as opposed to an array of buttons. Basically, things are going okay, but the program needs to know if a cell clicked on was clicked with the left or right mouse button.
Based on some searching around, I came upon something that seemed like a reasonable answer. Here is the code (greatly simplified):
The problem is that I get this error:Code:Public Class frmDGVTest Dim dgTest As New DataGridView Private Sub frmDGTest_Load(sender As Object, e As EventArgs) Handles Me.Load dgTest.ColumnCount = 9 dgTest.RowCount = 9 <etc> End Sub Private Sub dgTest_CellMouseClick(ByVal sender As Object, ByVal e As DataGridViewCellMouseEventArgs) Handles dgTest.CellMouseDown If e.Button = MouseButtons.Left Then <stuff> End If End Sub End Class
I simply do not understand this since I essentially copied the code directly. What did I do wrong?Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types.




Reply With Quote
