M
Miro
Vb2003, im still learning vb.net but I do not understand my output from this
logic.
If someone can help me out here.
Cor Ligthert, you I believe were on the right track of what Im trying to
create.
-Thank you very much for leading me on to Classes.
Ok here is my code. ( see below )
I have a class defined with 1 propertie and then create an Array of the
Class and msgbox out my output.
Why does each msgbox that shows bring up the value "This One" ? even
though the counter increments.
I would have assumed I should have gotten, "Hi" "Bye" "This One"
instead of
"This One" "This One" ... and so on.
Am I missing something I didnt read up on correctly?
Thanks,
Miro
================ code ================
Public Class SystemFilesClass
'Public SystemFilePublicData As String = "Miros Public Data"
Shared FieldName As String
Shared Property Prop_FieldName() As String
Get
Return FieldName
End Get
Set(ByVal Value As String)
FieldName = Value
End Set
End Property
End Class
====== somewhere else in code
Dim BlaSys(3) As SystemFilesClass
BlaSys(1).Prop_FieldName() = "Hi"
BlaSys(2).Prop_FieldName() = "Bye"
BlaSys(3).Prop_FieldName() = "This One"
MsgBox("test me=" & BlaSys.Length.ToString)
Dim nCounter As Integer
For nCounter = 1 To BlaSys.Length
MsgBox("blasys is " & BlaSys(nCounter).Prop_FieldName & " " &
nCounter.ToString) 'Each msgbox returns "THIS ONE" ?
Next nCounter
logic.
If someone can help me out here.
Cor Ligthert, you I believe were on the right track of what Im trying to
create.
-Thank you very much for leading me on to Classes.
Ok here is my code. ( see below )
I have a class defined with 1 propertie and then create an Array of the
Class and msgbox out my output.
Why does each msgbox that shows bring up the value "This One" ? even
though the counter increments.
I would have assumed I should have gotten, "Hi" "Bye" "This One"
instead of
"This One" "This One" ... and so on.
Am I missing something I didnt read up on correctly?
Thanks,
Miro
================ code ================
Public Class SystemFilesClass
'Public SystemFilePublicData As String = "Miros Public Data"
Shared FieldName As String
Shared Property Prop_FieldName() As String
Get
Return FieldName
End Get
Set(ByVal Value As String)
FieldName = Value
End Set
End Property
End Class
====== somewhere else in code
Dim BlaSys(3) As SystemFilesClass
BlaSys(1).Prop_FieldName() = "Hi"
BlaSys(2).Prop_FieldName() = "Bye"
BlaSys(3).Prop_FieldName() = "This One"
MsgBox("test me=" & BlaSys.Length.ToString)
Dim nCounter As Integer
For nCounter = 1 To BlaSys.Length
MsgBox("blasys is " & BlaSys(nCounter).Prop_FieldName & " " &
nCounter.ToString) 'Each msgbox returns "THIS ONE" ?
Next nCounter