|
-
Feb 25th, 2006, 10:52 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Help :No keyboard only mouse
I am using listbox with checkboxes into it & I want to opearte that listbox only with mouse not with keyboard then is that possible to do that? if yesthen please give any instant solution......Thanx.
Last edited by shirishdawane; Feb 25th, 2006 at 11:47 AM.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 11:47 AM
#2
Re: No keyboard only mouse
 Originally Posted by shirishdawane
I am using listbox with checkboxes into it & I want to opearte that listbox only with mouse not with keyboard then is that possible to do that? if yesthen please give any instant solution......Thanx. 
You can just cancel all of the KeyPresses going to it.
VB Code:
Private Sub List1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
-
Feb 25th, 2006, 11:51 AM
#3
Thread Starter
Hyperactive Member
Re: No keyboard only mouse
 Originally Posted by Comintern
You can just cancel all of the KeyPresses going to it.
VB Code:
Private Sub List1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Actually I am doing in this way :
VB Code:
Private Sub lstregno_ItemCheck(Item As Integer)
For i = 0 To lstregno.ListCount - 1
If lstregno.Selected(i) = True Then
lstregno.Selected(i) = False
End If
Next
lstregno.Selected(lstregno.ListIndex) = True
End Sub
but when I try to select/ disselect checkboxes with "Spacebar" button then it goes into infinite loob of FOR loop & shows error " Out of Stack". o is there any way to check that space bar has bben pressed ?
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 12:01 PM
#4
Re: No keyboard only mouse
 Originally Posted by shirishdawane
is there any way to check that space bar has bben pressed ?
VB Code:
Private Sub List1_KeyPress(KeyAscii As Integer)
if KeyAscii <> 32 then KeyAscii = 0
End Sub
-
Feb 25th, 2006, 12:08 PM
#5
Re: Help :No keyboard only mouse
Check for spacebar presses by testing the KeyAscii against 32. If you are somehow generating an infinite loop by recursing the function, add a static indicator to check if the code is in progress:
VB Code:
Private Sub List1_KeyPress(KeyAscii As Integer)
Dim iItem As Integer
Static bInProg As Boolean
If bInProg = False Then
If KeyAscii = 32 Then 'Check for space
For iItem = 0 To List1.ListCount - 1
If List1.Selected(iItem) = True Then
List1.Selected(iItem) = False
End If
Next
bInProg = True
List1.Selected(List1.ListIndex) = True
bInProg = False
Else
KeyAscii = 0
End If
End If
End Sub
-
Feb 27th, 2006, 02:10 AM
#6
Thread Starter
Hyperactive Member
Re: Help :No keyboard only mouse
Thanx guys it works.
Last edited by shirishdawane; Feb 27th, 2006 at 03:06 AM.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|