Set mouse speed in VB.net

Posted on 2009-05-27
Medium Priority
Last Modified: 2013-11-26

I am trying to set the mouse speed in VB.net 2008 in Vista. I am using this function.

The problem is it does not seem to work. When I did it throught the control panel, it did work. Any ideas?

Thank you!!!!!!!!!!!

Private Sub btnChangeMouseSpeed_Click(ByVal ns As String)
        ' Open Registry Key
        Dim NewKey As RegistryKey = _ 
                Registry.CurrentUser.OpenSubKey("Control Panel\\Mouse", True)
        ' Specify & Activate Mouse Speed
        NewKey.SetValue("MouseSpeed", ns)
        ' Max (Fastest) = 20
        ' Min (Slowest) = 0
    End Sub

Open in new window

Question by:webspirit
  • 3
  • 2

Author Comment

ID: 24481257
Perhaps it matters that I run this on a lapton that has a touchpad and a usb mouse??
LVL 83

Accepted Solution

CodeCruiser earned 2000 total points
ID: 24481296
Try this code

Private Sub btnChangeMouseSpeed_Click(ByVal ns As String)
        'Open Registry Key
        Dim ConKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Control Panel", False)
        Dim NewKey as RegistryKey = ConKey.OpenSubKey("Mouse", True)
        'Specify & Activate Mouse Speed
        NewKey.SetValue("MouseSpeed", ns)
        'Max (Fastest) = 20
        'Min (Slowest) = 0
    End Sub

Open in new window


Author Comment

ID: 24481507
It did not work. :(
LVL 83

Expert Comment

ID: 24481584
Use the same code to modify some other registry values to isolate the problem. I think it could be the permissions issue.

Author Comment

ID: 24481623
I 'll try, thanks!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
SingleRun is a tool that ensures that only one instance of an application is started, running it again brings the application to focus.
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

587 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