a vbnet class will not update my variables

Works perfectly fine for me…not sure what you tried as you never updated your code to show your attempts:

Public Class Form1

    Private messageManager As New MessageManager

    Private Sub ShowNumberBtn_Click(sender As Object, e As EventArgs) Handles ShowNumberBtn.Click
        messageManager.sendMessage()
    End Sub

    Private Sub ChangeNumberBtn_Click(sender As Object, e As EventArgs) Handles ChangeNumberBtn.Click
        messageManager.Number = 50
        MsgBox("Number Changed to : " & messageManager.Number)
    End Sub

End Class

Public Class NumberClass

    Property Number As Byte

End Class

Public Class MessageManager
    Inherits NumberClass

    Public Sub sendMessage()
        MessageBox.Show("Number = " & Number)
    End Sub

End Class

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top