I have an application built that has several forms. I use an XML file to store settings data (mainly folder names for data output) and I need each form to be able to access and modify the data. I'd also like each form to access functions from a main form (such as file parsing functions). I have read articles about properties and inheritance but I need some guidance as this topic is pretty confusing.
What I've been able to get to work is this
I put this code on my start form (StartForm). However, I am not able to save the XML file using this procedure (an error occurs). I'm not sure if I need to make a separate class or how I would be able to save settings to the file from each form. Please advise.
What I've been able to get to work is this
VB.NET:
Public ReadOnly Property UserName() As String
Get
Return TextBox1.Text
End Get
End Property
Public ReadOnly Property AssayCode() As String
Get
Return ComboBox1.Text.
End Get
End Property
Public Property AssaySettings As XDocument
Get
Return XDocument.Load("C:\assaysettings.xml"))
End Get
Set(ByVal value As XDocument)
XDocument.Save("C:\assaysettings.xml")) = value 'ERROR
End Set
End Property
I put this code on my start form (StartForm). However, I am not able to save the XML file using this procedure (an error occurs). I'm not sure if I need to make a separate class or how I would be able to save settings to the file from each form. Please advise.