Help with VS2008

Hi All!!
I have a VB6 app I am converting to .Net2008.  In VB6 I opened a form and hid it to reference values.  It contains information about the company such as name, address, minimum statement balances, credit card processor, and such like.
I would like to do the same thing in my 2008 app but I feel there is a much better way to do this than opening a form and hiding it. I don't know what it is but with some help from you guys I'll bet we can figure some thing out.  

Thanks for your help!!!

Jerry
JDL129Asked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
"What I would like to do is fill this 'Class' when the application opens."

So it really sounds like you only ever need ONE set of data on a "company" at any given time.  A SHARED class will make this quite easy:


    Public Class Company

        Public Shared Name As String
        Public Shared Address As String
        Public Shared TaxRate As Double
        ' etc...

    End Class

    Public Class Form1

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Company.Name = "Idle_Mind"
            Company.Address = "Experts Exchange"
            Company.TaxRate = 4.11
        End Sub

    End Class

Note that you can access the SHARED values in Company from ANYWHERE in your application!
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Typically you create a custom Class to hold your values and then pass a reference to an instance of that class around.  If you need only ONE instance of the class across the entire application then you could make it Shared.

It might be helpful to know WHERE the data is being passed from and to...then we can give a more specific example.
0
 
JDL129Author Commented:
Idle Mind!!!!
What I would like to do is fill this 'Class' when the application opens.  I will be getting the data from a table in the main dataset in the app.  It is called tblCompany and stores all of the information about the company.  I guess I would like to pass this data to a 'Class'? There are about 20 forms in this app that at times would require pieces of the data from the 'Class'.  How would I create and fill the 'Class' and how would I instantiate the 'Class' and retreive the pieces of data that I need such as the company name, address, tax rate, DEA, Phone, PharmacyLicense, etc.
As you can tell from my question I am pretty new at this so please...be gentle!!!  :-)

Thanks for your response!!

Jerry
0
 
JDL129Author Commented:
IM YOU ARE THE MAN!!!!!!!!!!!!!!!!!!!!!!!!
Thanks for your help, it was exactly what I needed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.