Results 1 to 4 of 4

Thread: Declaring variables

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70

    Resolved Declaring variables

    Hi,

    Q1.In vb.net how can you declare a variable that works for all foms in a project whithout having to declare it in every form?

    Q2. Almost the same: All my forms work with data, and in every form I have to declare a dataset and do a dataset.readxml(..). Can I do this somewhere so that it is valid for all forms automatically?

    Thanks in advance.
    Last edited by nacho2; Dec 2nd, 2004 at 12:54 PM.

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036
    Hi
    Q1 declare it has public
    VB Code:
    1. public a as string

    Q2) Create a class that encapsulates all the functionalities you need.


    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    That's what Modules are for.

    Declare the variables as public in a module and write the database coding in a public sub in the module.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70
    Thank you folks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width