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 data to and from a class is as follows. It works fine but it seems very complicated to me.
Code:
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-
Code:
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-
Code:
Public file_name as string
form-
Code:
Label1.Text = source_obj.file_name
or-
Code:
source_obj.file_name= Label1.Text
many thanks,
Steve