Solved

Visual Studio Visual Basic Button

Posted on 2007-03-23
1
230 Views
Last Modified: 2013-11-26
Have a button

BottonName: Testbutton
FlatStyle: Flat


That can't been seen --until the curser is on it---- turns to a darker color
Is thier a way to test the conditions

If  Textfields below
Advvariance=0            
Guestvariance=0
Cityvariance=0
and
SettlementDatetxt = current system date

Is their a way ------
When the cursor is on the button for it to be the color green if those conditions pass
and what event for the botton would it be?

Thanks
JK


0
Comment
Question by:fsuedu
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18782420
Use the MouseEnter()/MouseLeave() events:

    Private Sub Testbutton_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Testbutton.MouseEnter
        Testbutton.Tag = Testbutton.BackColor ' store the current color

        If someCondition Then
            Testbutton.BackColor = Color.Green
        Else
            Testbutton.BackColor = Color.Red
        End If
    End Sub

    Private Sub Testbutton_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Testbutton.MouseLeave
        Testbutton.BackColor = Testbutton.Tag ' restore the original color
    End Sub
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 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