Results 1 to 6 of 6

Thread: Last question

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    14
    I need to have some type of variable that will set the backcolor of command buttons. This color will be selected on my main form but needs to be used on all of my forms, is there a way to store for example: vbblue = variable from my startup form and have it seen by all the forms.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    Not exactly.

    Something like 'vbblue' is what is called an "Enumerated Type". This means that 'vbblue' is actually a CONSTANT and that means it is fixed throughout and can not be changed dynamically (ie when you are running your application).

    What you need to do is simply create a global variable to contain the color and then during the Form_Load event for each and every form you have you need to go through each of the command buttons and set that color.

    Its frustrating but thats just the nature of the beast

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    14
    How do I set a Global Variable:

    Dim CommandColor as String did not work

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    If you only have 1 form then you can do it at the top of that form... if you have more than one then you have to do it in a Module (Go to add to your VB project but select Module instead of Form)

    Code:
    Global CommandColor as String

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I think colors are stored in a Long data type.

  6. #6
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    I'm sure colours are stored as longs.
    You can also try declaring a public var As OLE-COLOR.
    That's the way usercontrol-colour-properties are declared.

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