locked
Passing variables RRS feed

  • Question

  • What would be the correct way to pass a variable from one .vb file to another?

    I get this value when I try to do it with ControlCharts.cn?

    Reference to a non-shared member requires an object reference.

    Wednesday, September 13, 2006 7:46 PM

Answers

  • You need to create an instance of the second class(form) before passing the variable

    Public Class FirstForm

    Private VariableInFirstFOrm as object

    Private SUb Test

    VariableInFirstForm =MyObject

    Dim f as New Form2

    f.VariableInSecondForm = VariableInFirstForm

    End Sub

    End CLass

    Public CLass Form2

    Dim VariableInSecondForm as object

    End Class

     

     

     

    Wednesday, September 13, 2006 7:51 PM
    Moderator

All replies

  • You need to create an instance of the second class(form) before passing the variable

    Public Class FirstForm

    Private VariableInFirstFOrm as object

    Private SUb Test

    VariableInFirstForm =MyObject

    Dim f as New Form2

    f.VariableInSecondForm = VariableInFirstForm

    End Sub

    End CLass

    Public CLass Form2

    Dim VariableInSecondForm as object

    End Class

     

     

     

    Wednesday, September 13, 2006 7:51 PM
    Moderator
  •  chazparks wrote:
    I get this value when I try to do it with ControlCharts.cn?

     

    FOr further clarification just post the code you are having problems with...

    Wednesday, September 13, 2006 7:52 PM
    Moderator