Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with my combo box and using mouse over event 1

Status
Not open for further replies.

Rmck87

Programmer
Jul 14, 2003
182
US
I have a combo box that brings up the projects that were worked on. But, whenever i put this code in to show that the user is hovering over the combo it doesn't let me select the combo drop down arrow. Whenever i select it, the drop down box comes up, but doesnt stay dropped down. Why not? Heres my code:




Private Sub cboProjectID_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.cboProjectID.BorderColor = 10485760
Me.cboProjectID.SpecialEffect = 0
End Sub

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.cboProjectID.BorderColor = 0
Me.cboProjectID.SpecialEffect = 2
End Sub



This is to sort of highlight the combobox so that the user knows he is over the combo. Just for another cool trick, if i cannot do this that is ok, but it was just something i was trying to do. Any help would be great thanks!

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
wait. hold on. i messed it up. are you saying to make it a module? or put it in the code behind the form?

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
shouldnt matter, but for unknown reasons, try dumping it into a module, see if that make a difference
 
Well, i have a question.


Private ChangeBorder as Boolean


what does that have anything to do with it. i mean what am i calling here?

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
no thats not working, the drop down is working but the effect and the border are not changing.

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
sweet thanks for all of the patience and help!

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
I just tried with the code below, it works fine. one thing i changed was in the Detail_Focus Sub

Code:
Option Compare Database
Private SetStyle As Boolean

Private Sub Combo0_GotFocus()
Me.Combo0.Requery
End Sub

Private Sub Combo0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If SetStyle = True Then
    Me.Combo0.SpecialEffect = 0
    SetStyle = False
End If
    
End Sub


Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If SetStyle = False Then
    Me.Combo0.SpecialEffect = 2
    SetStyle = True
End If
End Sub

Private Sub Form_Load()
SetStyle = True
End Sub
 
sorry, ignored colors....i used vbRed/Blue just for time sakes.

Code:
Option Compare Database
Private SetStyle As Boolean

Private Sub Combo0_GotFocus()
Me.Combo0.Requery
End Sub

Private Sub Combo0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If SetStyle = True Then
    Me.Combo0.SpecialEffect = 0
    Me.Combo0.BackColor = vbBlue
    SetStyle = False
End If
    
End Sub


Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If SetStyle = False Then
    Me.Combo0.SpecialEffect = 2
    Me.Combo0.BackColor = vbRed
    SetStyle = True
End If
End Sub

Private Sub Form_Load()
SetStyle = True
End Sub
 
where are you putting this code in the module or behind the form?

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
Alright!!!!!! Thanks alot John, it works. THanks for the patience and all the help. Enjoy the star!

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
where is setstyle getting its value?

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
SetStyle is to be considered as a Private Variable to the form itself meaning that only the form can read/write its value. When the form loads, we set its value to true. when it is true, then the combobox mousemove event will execute the code within and blah blah blah (all the junk we went over). I'm glad that it helped.

John
 
cool thanks! But i have one question. When did you put 'blah blah blah' into the code? I dont remember seeing that in there!

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
i use "blah blah blah" in my code when days are spent trying to find the 5 lines of simple code solutions, call it my trademark.

Good Luck
 
haha. alright. sounds like i should do the same!

One Ring to Rule Them All, One Ring to Find Them, One Ring to Bring Them All, and in the Darkness Bind Them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top