Solved

Visual Studio Visual Basic Button

Posted on 2007-03-23
1
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get the Y value of a line at X in a chart in VBA 28 74
VB6 Enviroment 3 37
2 Global Vars, 1 List Box 4 34
VB.net SQL Connection String Read Only 4 19
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

751 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