[Last Call] Learn how to a build a cloud-first strategyRegister Now


Help with VS2008

Posted on 2009-05-01
Medium Priority
Last Modified: 2013-11-26
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!!!

Question by:JDL129
  • 2
  • 2
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 24284496
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.

Author Comment

ID: 24284848
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!!

LVL 86

Accepted Solution

Mike Tomlinson earned 1000 total points
ID: 24287518
"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!

Author Closing Comment

ID: 31577107
IM YOU ARE THE MAN!!!!!!!!!!!!!!!!!!!!!!!!
Thanks for your help, it was exactly what I needed!

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question