Hi Folks,
I woke up and found that I have stone-age consciousness: I wrote some games as an amateur for personal use years ago in Visual Basic 6. Today, I want to revisit them and find that only the compiled applications worked. When I transferred the source codes
to VB2010 Express, there were errors (Declaration Expected) in every line. The design mode did not show up, and all I have are the source codes. The problem now is that I want to make changes to them and later explore the possibility of developing them further
and even distributing them. But I have no idea how to begin at this stage. If I can be testing them visually as I go along, I may be able to get by.
Please help me. I am so confused that I don't even know the right forum to use.
An example of the code is shown below.
VERSION 5.00
Begin VB.Form Form1
BackColor = &H0080C0FF&
Caption = "A Y O"
ClientHeight = 5355
ClientLeft = 60
ClientTop = 345
ClientWidth = 8460
LinkTopic = "Form1"
ScaleHeight = 5355
ScaleWidth = 8460
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 8
Left = 4560
Style = 1 'Graphical
TabIndex = 34
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 9
Left = 3120
Style = 1 'Graphical
TabIndex = 33
Top = 2760
Width = 975
End
Begin VB.ComboBox Combo3
Height = 315
Left = 5400
TabIndex = 32
Text = "Combo3"
Top = 4800
Visible = 0 'False
Width = 975
End
Begin VB.ComboBox Combo2
Height = 315
Left = 1560
TabIndex = 30
TabStop = 0 'False
Text = "Played"
Top = 4800
Visible = 0 'False
Width = 975
End
Begin VB.ComboBox Combo1
Height = 315
Left = 120
TabIndex = 29
Text = "Sequence"
Top = 4800
Visible = 0 'False
Width = 1095
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "Back one step"
Height = 735
Left = 6240
TabIndex = 28
TabStop = 0 'False
Top = 4440
Width = 855
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 3120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 4800
Visible = 0 'False
Width = 2100
End
Begin VB.CommandButton cmdA
Height = 375
Left = 3960
TabIndex = 27
TabStop = 0 'False
Top = 480
Width = 375
End
Begin VB.CommandButton cmdB
Height = 375
Left = 3960
TabIndex = 26
TabStop = 0 'False
Top = 3960
Width = 375
End
Begin VB.ComboBox cellB
Height = 315
Left = 7680
TabIndex = 25
Text = "Combo1"
Top = 4200
Visible = 0 'False
Width = 615
End
Begin VB.ComboBox cellA
Height = 315
Left = 7680
TabIndex = 24
Text = "Combo1"
Top = 120
Visible = 0 'False
Width = 615
End
Begin VB.CommandButton cmdStart
Caption = "Start"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 0
TabIndex = 23
TabStop = 0 'False
Top = 4200
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "Exit"
Height = 375
Left = 7200
TabIndex = 22
TabStop = 0 'False
Top = 4800
Width = 1095
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 11
Left = 360
Style = 1 'Graphical
TabIndex = 21
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 10
Left = 1680
Style = 1 'Graphical
TabIndex = 20
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 7
Left = 6000
Style = 1 'Graphical
TabIndex = 19
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 6
Left = 7320
Style = 1 'Graphical
TabIndex = 18
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 5
Left = 7320
Style = 1 'Graphical
TabIndex = 17
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 4
Left = 6000
Style = 1 'Graphical
TabIndex = 16
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 3
Left = 4560
Style = 1 'Graphical
TabIndex = 15
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 2
Left = 3120
Style = 1 'Graphical
TabIndex = 14
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 1
Left = 1680
Style = 1 'Graphical
TabIndex = 13
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdc
Appearance = 0 'Flat
BackColor = &H8000000A&
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Index = 0
Left = 360
Style = 1 'Graphical
TabIndex = 12
Top = 1200
Width = 975
End
Begin VB.ComboBox cell
Height = 315
Index = 11
Left = 120
TabIndex = 11
TabStop = 0 'False
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 10
Left = 720
TabIndex = 10
TabStop = 0 'False
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 9
Left = 1320
TabIndex = 9
TabStop = 0 'False
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 8
Left = 1920
TabIndex = 8
TabStop = 0 'False
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 7
Left = 2520
TabIndex = 7
TabStop = 0 'False
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 6
Left = 3120
TabIndex = 6
TabStop = 0 'False
Text = " "
Top = 720
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 5
Left = 3120
TabIndex = 5
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 4
Left = 2520
TabIndex = 4
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 3
Left = 1920
TabIndex = 3
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 2
Left = 1320
TabIndex = 2
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 1
Left = 720
TabIndex = 1
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.ComboBox cell
Height = 315
Index = 0
Left = 120
TabIndex = 0
TabStop = 0 'False
Top = 240
Visible = 0 'False
Width = 390
End
Begin VB.PictureBox Toolbar1
Align = 1 'Align Top
Height = 630
Left = 0
ScaleHeight = 570
ScaleWidth = 8400
TabIndex = 31
Top = 0
Width = 8460
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim recordnum%, Player As ComboBox, side As ComboBox, load As Integer
Private Sub cmdc_Click(Index As Integer)
Dim x%, l%, n%
x = Index
Select Case x
Case 0 To 5
Set side = cellA
Set Player = cellA
For n = 0 To 5
cmdc(n).BackColor = vbWhite
Next
For n = 6 To 11
cmdc(n).BackColor = vbGreen
Next
Case 6 To 11
Set side = cellB
Set Player = cellB
For n = 6 To 11
cmdc(n).BackColor = vbWhite
Next
For n = 0 To 5
cmdc(n).BackColor = vbGreen
Next
End Select
l = cell(x).ListCount
cell(x).Clear
playcell x, l 'Then play
look 'And display
recordnum = recordnum + 1
If recordnum > 0 Then Command1.Visible = True
Data1 = recordnum
Combo1.AddItem recordnum & "," & x
Combo2.AddItem x
Combo3.AddItem recordnum & "," & x
End Sub
Private Sub cmdExit_Click()
MsgBox ("All work and no play..." & vbCrLf & _
"For more information, contact:" & vbCrLf & _
"GLOBAL INTEGERS, www.globalintegers.com")
Unload Me
End Sub
Private Sub cmdStart_Click()
Dim x%, s%, n% ',load%
On Error GoTo errorloading
'load = InputBox("With how many seeds?")
For x = 0 To 11 'Populate cells
cell(x).Clear
For s = 1 To 4 'load
cell(x).AddItem "o"
cmdc(x).BackColor = vbGreen
cmdc(x).Visible = True
Next s
Next x
recordnum = 0
cellA.Clear
cellB.Clear
look
Combo1.Clear
Combo2.Clear
Combo3.Clear
Data1 = recordnum
cmdA.Visible = True
cmdB.Visible = True
'Command1.Visible = True
'Combo1.Visible = True
Combo2.Visible = False
'Combo3.Visible = True
Data1.Visible = False
cmdStart.Caption = "Reset"
errorloading:
Exit Sub
End Sub
Private Sub look()
Dim x%
For x = 0 To 11
cmdc(x).Caption = cell(x).ListCount
If cmdc(x).Caption = 0 Then
cmdc(x).Enabled = False
Else
cmdc(x).Enabled = True
End If
If cmdc(x).BackColor = vbWhite Then
cmdc(x).Enabled = False
End If
Next x
If cellA.ListCount >= 24 Then
MsgBox "Game over! A has won."
End If
If cellB.ListCount >= 24 Then
MsgBox "Game over! B has won."
End If
cmdA.Caption = cellA.ListCount
cmdB.Caption = cellB.ListCount
End Sub
Private Sub playcell(x As Integer, h As Integer)
Dim Player As ComboBox
Static currentindex As Integer
currentindex = x 'Initialize current cell
Set Player = determineplayer(x)
For h = 0 To h - 1 'For the number in hand,
currentindex = currentindex + 1 'Increment each cell
If currentindex = 12 Then 'At 12 go to 1
currentindex = 0
End If
If currentindex = x Then 'Skip playing hole, and
currentindex = currentindex + 1
If currentindex = 12 Then 'At 12 go to 1
currentindex = 0
End If
End If
cell(currentindex).AddItem "o" 'Drop a seed in every other hole
' Debug.Print currentindex 'Fine
Next h
If determineside(currentindex).Name <> Player.Name Then
capture (currentindex)
End If
'record
End Sub
Private Sub capture(f As Integer)
Dim l%, x%, C As ComboBox
'Set c = cell(f)
l = cell(f).ListCount
If l > 1 And l < 4 Then 'Sets condition for capture
For l = 1 To l
Beep
cell(f).RemoveItem 0 'Empty that cell into...
Player.AddItem "o" 'Playee's pocket
Next
f = (f - 1)
If f < 0 Or f = 5 Then 'Set conditon for ending recursion
Exit Sub
End If
capture (f) 'recur
End If
End Sub
Private Function determineplayer(i As Integer) As ComboBox
Select Case i
Case 0 To 5
Set determineplayer = cellA
Case 6 To 11
Set determineplayer = cellB
End Select
End Function
Private Function determineside(ope As Integer) As ComboBox
Select Case ope
Case 0 To 5
Set determineside = cellA
Case 6 To 11
Set determineside = cellB
End Select
End Function
Private Sub play(x As Integer)
Dim l%, n%
' x = Index
Select Case x
Case 0 To 5
Set side = cellA
Set Player = cellA
For n = 0 To 5
cmdc(n).BackColor = vbWhite
Next
For n = 6 To 11
cmdc(n).BackColor = vbGreen
Next
Case 6 To 11
Set side = cellB
Set Player = cellB
For n = 6 To 11
cmdc(n).BackColor = vbWhite
Next
For n = 0 To 5
cmdc(n).BackColor = vbGreen
Next
End Select
l = cell(x).ListCount
cell(x).Clear
playcell x, l 'Then play
look 'And display
recordnum = recordnum + 1
Data1 = recordnum
Combo1.AddItem recordnum & "," & x
Combo2.AddItem x
Combo3.AddItem recordnum & "," & x
End Sub
Private Sub Command1_Click()
Dim x%, s%, n%
On Error GoTo errorloading
'load = InputBox("With how many seeds?")
If Data1 = 0 Then Command1.Visible = False
For x = 0 To 11 'Populate cells
cell(x).Clear
For s = 1 To 4 'load
cell(x).AddItem "o"
cmdc(x).BackColor = vbGreen
Next s
Next x
recordnum = 0
cellA.Clear
cellB.Clear
look
Combo1.Clear
Combo3.Clear
Data1 = recordnum
n = Combo2.ListCount
For n = 1 To n - 1
play Combo2.List(0)
Combo2.RemoveItem 0
Next
Combo2.RemoveItem 0
errorloading:
Exit Sub
End Sub
Private Sub Form_Load()
Dim x%
For x = 0 To 11
cmdc(x).Visible = False
Next
cmdA.Visible = False
cmdB.Visible = False
Command1.Visible = False
Combo1.Visible = False
Combo2.Visible = False
Combo3.Visible = False
Data1.Visible = False
MsgBox "Please note that play will be in clockwise direction!", vbInformation, "GLOBALINTEGERS"
End Sub