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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order of mouse clicks. 2

Status
Not open for further replies.

rgreiser

Programmer
Mar 12, 2003
6
US
I have two list boxes, I'll call boxA and boxB. I need to determine which box was clicked on first. I figure I need to put something for the event handlers for each box, just haven't figured out what yet. Any help would be greatly appreciated. Thanx,
Rhonda
 
something like this?

Code:
private bolBoxAClickedFirst as boolean

private sub boxA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) handles boxA.Click
  messagebox.show("I was clicked first (I being BoxA)")
  bolboxaClickedfirst = true
end sub

private sub boxB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) handles boxB.Click
  messagebox.show("Nope, I was clicked first (I being BoxB)")
  bolboxBClickedfirst = false
end sub

private sub someothersub()
if bolboxAclickedfirst then
  messagebox.show("You clicked BoxA first")
else
  messagebox.show("Nope, you clickes BoxB first, don't ask me why, I told you not to.")
endif
end sub

Christiaan Baes
Belgium

"My new site" - Me
 
My longer version
Code:
    Public ClickFirst As Boolean = False
    Public FirstList As String = ""
'==================================================

    Private Sub BoxA_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BoxA.Click
        If ClickFirst = False Then
            ClickFirst = True
            FirstList = "BoxA"
            MessageBox.Show("Box A cliked first")
        ElseIf FirstList = "BoxA" Then
            MessageBox.Show("Box A cliked first")
        Else
            MessageBox.Show("Box B cliked first")
        End If

    End Sub
'=====================================================
    Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
        ClickFirst = False
        FirstList = ""
    End Sub
'=====================================================
    Private Sub BoxB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BoxB.Click
        If ClickFirst = False Then
            ClickFirst = True
            FirstList = "BoxB"
            MessageBox.Show("Box B cliked first")
        ElseIf FirstList = "BoxB" Then
            MessageBox.Show("Box B cliked first")
        Else
            MessageBox.Show("Box A cliked first")

        End If
    End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top