scrabble game in VB: Help

PSully

New member
Joined
Mar 13, 2008
Messages
1
Programming Experience
Beginner
I am making a Scrabble game in VB 2008. I made the game board in Fireworks and imported it into VB. The letter tiles are made from buttons in VB.

The problem I am having is with drag drop. I can't get the letter tiles to drag and drop on the equired spot on the gameboard, tried all the examples and am stuck now at this early stage. Any help or advice would be greatly appreciated.


VB.NET:
Private Sub ALetter_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GameBoard.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim pic As PictureBox = CType(sender, PictureBox)
' Invoke the drag and drop operation.
If Not pic.Image Is Nothing Then
pic.DoDragDrop(pic.Image, DragDropEffects.Move Or DragDropEffects.Copy)
End If
End If
ALetter.AllowDrop = True
GameBoard.AllowDrop = True.
Tried this, no errors but still wont work.
 
Last edited by a moderator:
Thats because technically you are not doing a drag and drop.

What you want to do is move the button at runtime.

On the mousedown for the button, you need to set a variable (boolean) to true, to say that you want to move the button.

On the mousemove, if the variable is true then move the button according to the values in the mouseeventargs

On the mouseup, set the variable to false.


Hope that gives you a nudge in the correct direction :)
 
Back
Top