Hello everyone.
It's like I'm in big trouble again.
I need a globar static variable...
I have an array of checkers. Checker is a class created by me with properties.
Well during Runtime some elements of UsrCheckers array change their values properties.
For example UsrChecker(0).xLocation= 400 UsrChecker(0).yLocation= 100 and after User moves it in a new possition
these values change. ex UsrChecker(0).xLocation= 650 UsrChecker(0).yLocation= 350
The what I want to do is to have a variable that keeps the initial values of the specified element each time, in my example
these are initial values UsrChecker(0).xLocation= 400 UsrChecker(0).yLocation= 100
I tried
Public PlngChckr As New Checker ' general declarations of the form I tried too, shared instead of public
Public Function HoldInitialValuesPlayingChecker(ByVal PlayingChckr As Checker) As Checker
Static CrntPlayingChecker As Checker
CrntPlayingChecker = PlayingChckr
Return CrntPlayingChecker
End Function
Public Sub Undo(ByVal chckr As Checker)
Static CrntPlayingChecker As New Checker
CrntPlayingChecker = chckr
end sub
Public Sub UsrCheckersClickHandler(ByVal Sender As Object, ByVal e As System.EventArgs)
Dim UsrI As Byte
For UsrI = 0 To UsrCheckers.Length - 1
If strName = UsrCheckers(UsrI).Name Then
Instance = UsrCheckers(UsrI)
PlngChckr = Me.BrdPB.HoldInitialValuesPlayingChecker(UsrCheckers(UsrI))
exit for
End If
Next
End Sub
Private Sub UndoBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoBtn.Click
Dim chckr As New Checker
Me.BrdPB.Undo(PlngChckr)
End Sub
No effect
Vb.net 2005 doesn't allow to declare public Static variables even to general declaration of a form, even to module.
Variabe CrntPlayingChecker holds the updated latest values. So PlngChckr doesn't keep initial values
but updated...
Any help please????
Any help will be much appreciated.
Thank you very much in advanced.
It's like I'm in big trouble again.
I need a globar static variable...
I have an array of checkers. Checker is a class created by me with properties.
Well during Runtime some elements of UsrCheckers array change their values properties.
For example UsrChecker(0).xLocation= 400 UsrChecker(0).yLocation= 100 and after User moves it in a new possition
these values change. ex UsrChecker(0).xLocation= 650 UsrChecker(0).yLocation= 350
The what I want to do is to have a variable that keeps the initial values of the specified element each time, in my example
these are initial values UsrChecker(0).xLocation= 400 UsrChecker(0).yLocation= 100
I tried
Public PlngChckr As New Checker ' general declarations of the form I tried too, shared instead of public
Public Function HoldInitialValuesPlayingChecker(ByVal PlayingChckr As Checker) As Checker
Static CrntPlayingChecker As Checker
CrntPlayingChecker = PlayingChckr
Return CrntPlayingChecker
End Function
Public Sub Undo(ByVal chckr As Checker)
Static CrntPlayingChecker As New Checker
CrntPlayingChecker = chckr
end sub
Public Sub UsrCheckersClickHandler(ByVal Sender As Object, ByVal e As System.EventArgs)
Dim UsrI As Byte
For UsrI = 0 To UsrCheckers.Length - 1
If strName = UsrCheckers(UsrI).Name Then
Instance = UsrCheckers(UsrI)
PlngChckr = Me.BrdPB.HoldInitialValuesPlayingChecker(UsrCheckers(UsrI))
exit for
End If
Next
End Sub
Private Sub UndoBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoBtn.Click
Dim chckr As New Checker
Me.BrdPB.Undo(PlngChckr)
End Sub
No effect
Vb.net 2005 doesn't allow to declare public Static variables even to general declaration of a form, even to module.
Variabe CrntPlayingChecker holds the updated latest values. So PlngChckr doesn't keep initial values
Any help please????
Any help will be much appreciated.
Thank you very much in advanced.