Results 1 to 6 of 6

Thread: A little Q/A about Global Variables

  1. #1

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    A little Q/A about Global Variables

    I've started to use this program called Gambas for Linux (a basic program) and I was reading the help file about differences between Gambas and VB, and it said it had got rid of declaring global variables because it is bad practice. Is this right? If so, then how is it?

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: A little Q/A about Global Variables

    One problem could be that, being global, thhey could be changed unexpectedly.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: A little Q/A about Global Variables

    Quote Originally Posted by Pasvorto
    One problem could be that, being global, thhey could be changed unexpectedly.
    Correct....having said that, however, if you are paying attention to what you are doing, this will not be an issue.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: A little Q/A about Global Variables

    It's not 'bad' per se: it depends upon your choice of development paradigm.


    edit: opinion removed.
    second edit: gratuitous acute accent removed.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: A little Q/A about Global Variables

    AS with anything else, it's all bout using the right tool for the right job. As a general practice, I avoid them when possible. However, from time to time they come in handy.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: A little Q/A about Global Variables

    Quote Originally Posted by techgnome
    As a general practice, I avoid them when possible.
    I agree....typically I will have a global recordset object and a global string for SQL statements, but, by in large, the rest of my variables are Private at the form level.

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