Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple dim problem 1

Status
Not open for further replies.

JAKM

Programmer
Jul 29, 2002
6
CA
This is simple problem I know, but I'm my head is still in Qbasic mode which is where this code works

Type Inventory
Inv1 As String * 40
Inv2 As String * 40
Inv3 As String * 40
Inv4 As String * 40
Inv5 As String * 40
Inv6 As String * 40
Inv7 As String * 40
Inv8 As String * 40
Inv9 As String * 40
Inv10 As String * 40
Inv11 As String * 40
End Type

Dim you As Inventory
Data "Phaser", "Rations", "Flashlight", "Disrupter", "Communicator", "Code Key A", "Code Key B", "Code Key C", "Tricorder", "Tricorder Adapter", " "

Error occurs at "Phaser" "Compile error: invalid outside procedure"
 
The Data keyword does not work the same in VB6 as in classic Basics

Just use something like:
Code:
Dim you As Inventory
With you
.inv1 = "Phaser"
.inv2 = "Rations"
End With
Let me know if this helps

Check out FAQ222-2244
 
I just tried Your recommened code, unfortunately the same error came up at "with you"
 
The type declaration needs to be in a module but the code last pasted need to be in the form, maybe in the Form_Load sub. Let me know if this helps

Check out FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top