Pharnax
04-15-2008, 04:29 AM
Ok so here's my problem:
I've made a type to store some values, and it works fine on my first form, but on my second form I can't access the variables I've stored as my type.
First form:
Option Explicit
Dim playername(0 To 4) As String
Private Type Person
pName As String
End Type
Dim p(0 To 4) As Person
Private Sub Command1_Click()
Open App.Path & "\Players.txt" For Append As #iFileNo
Print #iFileNo, Text1.Text
Close #iFileNo
End Sub
Private Sub Command2_Click()
Open App.Path & "\Players.txt" For Input As #iFileNo
Line Input #iFileNo, playername(0)
Close #iFileNo
p(0).pName = playername(0)
End Sub
Second Form:
Private Sub Form_Load()
List1.AddItem p(0).pName
End Sub
And I get the error "Sub or Function not defined". How can I make it recognize my UDT on the second form?
I've made a type to store some values, and it works fine on my first form, but on my second form I can't access the variables I've stored as my type.
First form:
Option Explicit
Dim playername(0 To 4) As String
Private Type Person
pName As String
End Type
Dim p(0 To 4) As Person
Private Sub Command1_Click()
Open App.Path & "\Players.txt" For Append As #iFileNo
Print #iFileNo, Text1.Text
Close #iFileNo
End Sub
Private Sub Command2_Click()
Open App.Path & "\Players.txt" For Input As #iFileNo
Line Input #iFileNo, playername(0)
Close #iFileNo
p(0).pName = playername(0)
End Sub
Second Form:
Private Sub Form_Load()
List1.AddItem p(0).pName
End Sub
And I get the error "Sub or Function not defined". How can I make it recognize my UDT on the second form?