Use variable in two classes

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I have a vb file with 2 classes:

Public Class webform
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender ...) Handles MyBase.Load
...
End Sub
End Class

Class myClass
Function myFunction
...
End Function
...
End Class

I need a variable which value can be used in by both classes.
Is this possible?

Thank You,
Miguel
 
If you are calling a method on one class from another, you can make that
variable an argument to the method, and just pass it that way.
 
Not sure what you mean. The value can always be passed as parameters or set
as properties.

You could; however, have a static variable on one class that can be used
directly by another class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top