Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Persist changes made to data in a form across form invocations

$
0
0
I have a subsidiary form where I can enter data and then save it before closing the form and going back to using the main form. When I re-open the subsidiary form, I cannot see the changes in the data that I had entered earlier. Can anyone tell me where I'm wrong ?
MainForm.vb
    Public Class Maincls
    oTestObj as New Testcls
    oTestObj.XYZ = "XYZ"

    Private Sub SoftwareSettingsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SoftwareSettingsToolStripMenuItem.Click

    Testcls.tbXYZ.Text = oTestObj.m_XYZ
    Testcls.Show()
    End Sub
    End Class


    Form_Testcls.vb
    Public Class Testcls

    Structure Params
    Dim m_XYZ as String
    End Structure
    Dim oParams as Params

    Public Sub New ()
    InitializeComponent()
    End Sub

    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
    XYZ = tbXYZ.Text
    Me.Hide()
    End Sub

    Public Property XYZ() As String
            Get
                Return Me.oparams.m_XYZ
            End Get
            Set(ByVal value As String)
                Me.oparams.m_XYZ = value
            End Set
       End Property
    End Class

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>