- Код: Выделить всё
Private Function GetCard(Line As Integer, Pos As Integer, view As Boolean) As TCard
Dim i As Integer
For i = PACK_TOTAL - 1 To 0 Step -1
If Well(Line, Pos, i).b_Is Then
If Not view Then
Well(Line, Pos, i).b_Is = False
GetCard = Well(Line, Pos, i)
End If
End If
MsgBox "Неверная попытка взять карту!"
GetCard = Well(0, 0, 0) ' !!!!Вот эту строку подсвечивает.!!!!
Next i
End Function
Вот класс:
- Код: Выделить всё
'local variable(s) to hold property value(s)
Private mvarSuit As Integer 'local copy
Private mvarValue As Integer 'local copy
Private mvarb_Is As Boolean 'local copy
Public Property Let b_Is(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.b_Is = 5
mvarb_Is = vData
End Property
Public Property Get b_Is() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.b_Is
b_Is = mvarb_Is
End Property
Public Function GetValue() As Integer
GetValue = Value
End Function
Public Function GetSuit() As Integer
GetSuit = Suit
End Function
Public Sub Init(i_value As Integer, i_suit As Integer)
Suit = i_suit
Value = i_value
b_Is = True
End Sub
Public Property Let Value(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Value = 5
mvarValue = vData
End Property
Public Property Get Value() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Value
Value = mvarValue
End Property
Public Property Let Suit(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Suit = 5
mvarSuit = vData
End Property
Public Property Get Suit() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Suit
Suit = mvarSuit
End Property
Ошибка! Object Variable or With block not set!
Инициализирую переменную класса так
- Код: Выделить всё
Private Sub MDIForm_Load()
Set Pack = New TPack
Dim i, j, k As Integer
For i = 0 To 4
For j = 0 To 4
For k = 0 To PACK_TOTAL - 1
Set Well(i, j, k) = New TCard
Next k
Next j
Next i
End Sub
Вот сам проект без отрисовки.