Set mouse speed in VB.net

Hi,

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

webspiritAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

webspiritAuthor Commented:
Perhaps it matters that I run this on a lapton that has a touchpad and a usb mouse??
0
CodeCruiserCommented:
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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
webspiritAuthor Commented:
It did not work. :(
0
CodeCruiserCommented:
Use the same code to modify some other registry values to isolate the problem. I think it could be the permissions issue.
0
webspiritAuthor Commented:
I 'll try, thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.