Steve36445
Well-known member
- Joined
- Dec 23, 2007
- Messages
- 58
- Programming Experience
- 10+
Can you help me please?
I am trying to get my head around classes.
As far as I can make out the recommended way of getting include data to and from a class is as follows. It works fine but it seems very complicated to me.
Accessed by-
Can anyone please explain to me why I cannot just declare a public variable in the class and access it from calling form as below.
Class-
form-
or-
many thanks,
Steve
I am trying to get my head around classes.
As far as I can make out the recommended way of getting include data to and from a class is as follows. It works fine but it seems very complicated to me.
VB.NET:
Private fn As String
Public Property file_name() As String
Get
Return fn
End Get
Set(Value As String)
fn = Value
End Set
Accessed by-
VB.NET:
Label1.Text = source_obj.file_name
Can anyone please explain to me why I cannot just declare a public variable in the class and access it from calling form as below.
Class-
VB.NET:
Public file_name as string
form-
VB.NET:
Label1.Text = source_obj.file_name
or-
VB.NET:
source_obj.file_name= Label1.Text
many thanks,
Steve