Results 1 to 8 of 8

Thread: [RESOLVED] listbox click

  1. #1

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Resolved [RESOLVED] listbox click

    when i hover over an item in list1 and click it , its clicked once but then right after i clicked it how do i make it click auto just once on that same item ? please urgent

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: listbox click

    Quote Originally Posted by ladoo View Post
    ... how do i make it click auto just once on that same item ?
    Can you explain it better?
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: listbox click

    when i single click on any item in list1 it counts as 1 click , right after i clicked it with mouse how do i get the programme to click that same item just once again

  4. #4

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: listbox click

    i tried


    Code:
    Dim J As Integer, ii As Integer
     For J = List1.ListCount - 1 To 0 Step -1
              If InStr(List1.Text, "@yahoo.com") Then
      Else
      Text2.Text = "@yahoo.com"
       List1.Selected(0) = True
        End If
         If InStr(List1.Text, "@ort.nl.rogers.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@rogers.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@xtra.co.nz") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@att.net") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@rocketmail.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@ymail.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@yahoo.cn") Then
        Text2.Text = ""
        
      Else
        End If
         If InStr(List1.Text, "@kimo.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@talk21.com") Then
        Text2.Text = ""
        
      Else
        End If
        If InStr(List1.Text, "@btinternet.com") Then
        Text2.Text = ""
        
      Else
        End If
    Exit For
    DoEvents
    Next J
    when i click it , it goes to top of the list always



    list1 items

    demo1
    demo2
    demo3
    demo4

    say i clicked on demo2 once , how do i get programme to click on that just once more

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: listbox click

    Why did you put in all those empty else statements?
    Why do you have an exit for at the bottom of the loop? You do know that it will not loop with this in there right?
    Also the doevents will never execute as you are jumping out of the loop on the line before it

    Why do you want the program to click you list item again after it is clicked the first time?

    You will get better results if you describe what you are trying to accomplish rather than how you are trying to do it.
    So what is the actual goal here? It would seem that making the click event fire again is not a good idea and there is probably a better way to do whatever it is you are trying to do.

  6. #6

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: listbox click

    its ok il figure it out

  7. #7
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: listbox click

    Try:

    Code:
    Private Sub List1_Click()
        Dim i As Integer
        Static bClicking As Boolean
    
        If Not bClicking Then
            bClicking = True
            i = List1.ListIndex
            List1.Selected(i) = False
            List1.Selected(i) = True
            bClicking = False
        End If
    End Sub
    Last edited by Bonnie West; May 18th, 2013 at 06:51 AM. Reason: Modified code
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  8. #8

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: listbox click

    thanks allot bonnie working em hugz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width