Visual Basic 4.0 - 2 Questions - Command Button Backcolor, Public Statement 
Author Message
 Visual Basic 4.0 - 2 Questions - Command Button Backcolor, Public Statement

1 - I'm sure this is a bug, but I can't find anything from the Tech Support
Search engine.  When I try to change the Backcolor Property for a Command
button, I get the drop down box and can pick a color and the code for the
color appears in the Property list, but the Button stays gray no matter
what.

2 - I'm not sure whether I'm doing it right or not but when I try to type
in the Declarations the statement -


I get a MSGBOX that hightlights "as" and says "expected end statement."  
If I leave off the "as Currency" I don't get an error message, but the
value I put into it in one module is not available in other modules.  What
am I doing wrong?  



Tue, 03 Apr 2001 03:00:00 GMT  
 Visual Basic 4.0 - 2 Questions - Command Button Backcolor, Public Statement
Hi Sam,

:1 - I'm sure this is a bug, but I can't find anything from the Tech Support
:Search engine.  When I try to change the Backcolor Property for a Command
:button, I get the drop down box and can pick a color and the code for the
:color appears in the Property list, but the Button stays gray no matter
:what.

Just a guess, but I imagine that what is happening here is that the
CommandButton is being created using a WindowClass that just uses the system 3D
face colour, no matter what BackColor you specify.

The real question is, of course, why does it have a BackColor property?

:2 - I'm not sure whether I'm doing it right or not but when I try to type
:in the Declarations the statement -
:

:
:I get a MSGBOX that hightlights "as" and says "expected end statement."
:If I leave off the "as Currency" I don't get an error message, but the
:value I put into it in one module is not available in other modules.  What
:am I doing wrong?

If you have a type declaration character, you don't need to specify the data

Is the variable in a module, a form or a class?  If it is a public member of a
form, you have to refer to it as Form1.Passamt.  If it is a public member of a
class, you have to create an instance of the class, and refer to it as
Class1.Passamt.  If it is a public variable in a standard code module, it is
global and should be visible everywhere.

HTH

    - Paul



Tue, 03 Apr 2001 03:00:00 GMT  
 Visual Basic 4.0 - 2 Questions - Command Button Backcolor, Public Statement

Quote:

>1 - I'm sure this is a bug, but I can't find anything from the Tech Support
>Search engine.  When I try to change the Backcolor Property for a Command
>button, I get the drop down box and can pick a color and the code for the
>color appears in the Property list, but the Button stays gray no matter
>what.

In VB4 and earlier, the BackColor property of a command button only affects
the 4 corner pixels of the button, not the button face color, which is a
system wide setting. On Win95 and NT4 style command buttons, the corner
pixels are no longer present and changing the backcolor doesn't do anything
at all.

On VB5 and beyond, you can set the Style property of the command button to
Graphical and then you can set the BackColor property to a different color.

Quote:
>2 - I'm not sure whether I'm doing it right or not but when I try to type
>in the Declarations the statement -


>I get a MSGBOX that hightlights "as" and says "expected end statement."
>If I leave off the "as Currency" I don't get an error message, but the
>value I put into it in one module is not available in other modules.  What
>am I doing wrong?



As for the other problem, where are you declaring the Public variable? If
you are declaring it in a form or class, you must qualify it with the object
name, for example:  Form1.Passamt.

Frank Carr



Tue, 03 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. FS: Mastering Microsoft Visual Basic 4.0 and Visual C++ 4.0 CD-ROMs

2. Visual Basic 4.0 usage of DLLs written in Visual C++ 4.0

3. Visual Basic 4.0 usage of DLLs written in Visual C++ 4.0

4. Visual Basic 4.0 Commands

5. Visual Basic 4.0 MKDir command oddity

6. Changing Visual Basic Command button

7. Visual Basic Command Buttons

8. backcolor command button problem

9. BackColor of Command button

10. Command Button Backcolor (VB3)

11. Visual Basic 3.0 vs Visual Basic 4.0

12. How to change backcolor for Command Buttons

 

 
Powered by phpBB® Forum Software