Greetings,
I'm following a VB tutorial on how to make MineSweeper (Link:
https://www.youtube.com/watch?v=YJP0...66177&index=15)
Tom's tutorial's code has changed between videos so I've got errors:
1. AddHandler C.MouseClick, AddressOf MineClick()
- Error: Argument not specified for parameter 'sender' of 'Private Sub MineClick(sender As Object, e as Mouse EventArgs)'
- Error: Argument not specified for parameter 'e' of 'Private Sub MineClick(sender As Object, e as Mouse EventArgs)'
The Sub it's referring to is this:
Private Sub MineClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim M As MineCell1 = sender
If e.Button = MouseButtons.Left Then
If M.HasMine Then
For Each MC As MineCell1 In MineField
If MC.HasMine Then MC.view = Mine
MC.Refresh()
Next
End If
If M.Number > 0 Then
M.view = Number
M.Refresh()
End If
'------------------------------------------------------------
ElseIf e.Button = MouseButtons.Right Then
Select Case M.view
'Blank cell right click
Case Button
M.view = Flag
M.Refresh()
'Flagged mine cell right click
Case Flag
M.view = Question
M.Refresh()
Case Else
M.view = Button
M.Refresh()
End Select
End If
End Sub
'Each case is referring to an enum called MineCell1
Another bug, but I think it'll go away if we fix the AddHandler error:
The bold part of the code is supposed to change the view of the MineCells when you click on them (change to a mine, number etc) But when I left click click on them nothing happens. The right click works (puts a flag or a question mark on the MineCell).
If anyone could give advice on a potential fix that'd me much appreciated. I've also attached a pdf file with all my code if you want to refer to it.