error invalid name space?

mshahid

Active member
Joined
Aug 23, 2012
Messages
29
Programming Experience
Beginner
Hi, i am a newbie for vb.net. here is an issue i am trying to declare structure but its giving me error invalid name space, please someone help me, i'll be thankful to you. i know it will be very small problem but as i mentioned i am a newbie so please help me out. below is code chunk.

Structure Customer
Dim Company As String
Dim Address As String
Dim city As String
Dim Country As String
Dim CustomerSince As Date
Dim Balance As Decimal

End Structure

Private Customers(7) As Customer
Private Cust As Customer
Public CurrentIndex As Intege
 
This:
invalid name space
and this:
Statement is not valid in a namespace
don't mean nearly the same thing. It is VERY important that you provide accurate information when posting. Otherwise we can waste our time and yours looking for completely the wrong thing. When posting code or error messages, post EXACTLY what you see and not an approximation.

Any way, that error is referring to those last three lines. You are trying to declare member variables that are not members of anything. Declarations like that are only valid inside a type, i.e. a class or structure. If you want to create an array of Customer values then presumably you want that to belong to something, e.g. a form. Put those declarations in that form or wherever else it is that they belong.
 
Back
Top