|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Caps Lock and Num Lock ?vs2005? I was doing this in vs2003... Private Sub SetPanelLocks() Try Dim numLockValue As Integer = 0 Dim capsLockValue As Integer = 0 With Me.sbrApplication.Panels(panelIndex.AppCapsLock) capsLockValue = GetKeyState(Keys.CapsLock) If CType(capsLockValue, Boolean) = True Then .Text = "Caps On" Else .Text = "Caps Off" End If End With With Me.sbrApplication.Panels(panelIndex.AppNumLock) numLockValue = GetKeyState(Keys.NumLock) If CType(numLockValue, Boolean) = True Then .Text = "Num On" Else .Text = "Num Off" End If End With Catch ex As Exception End Try End Sub I'm using the api GetKeyState with the Keys.NumLock and Keys.CapsLock. However, this is not converting to VS2005. What is the best way to set the status of these keys using VB2005? Thanks in advance! Jerry M If you use VB.NET 2005 just check this:
My.Computer.Keyboard.CapsLock and more, check the whole My.Computer.Keyboard class and you'll find what you need. Regards, Adriano Palmieri. Show quote "JerryWEC" wrote: > What is the best way to do Caps Lock and Num Lock for a statusbar control in > vs2005? > > I was doing this in vs2003... > > Private Sub SetPanelLocks() > > Try > > Dim numLockValue As Integer = 0 > > Dim capsLockValue As Integer = 0 > > With Me.sbrApplication.Panels(panelIndex.AppCapsLock) > > capsLockValue = GetKeyState(Keys.CapsLock) > > If CType(capsLockValue, Boolean) = True Then > > .Text = "Caps On" > > Else > > .Text = "Caps Off" > > End If > > End With > > With Me.sbrApplication.Panels(panelIndex.AppNumLock) > > numLockValue = GetKeyState(Keys.NumLock) > > If CType(numLockValue, Boolean) = True Then > > .Text = "Num On" > > Else > > .Text = "Num Off" > > End If > > End With > > Catch ex As Exception > > End Try > > End Sub > > I'm using the api GetKeyState with the Keys.NumLock and Keys.CapsLock. > However, this is not converting to VS2005. What is the best way to set the > status of these keys using VB2005? > > Thanks in advance! > Jerry M > > > Did this get answered in the newsgroup, and my newsreader
(OE) is keeping it a secret from me? Can you re-post the answer? Original question was: What is the best way to do Caps Lock and Num Lock for a statusbar control in vs2005? Thanks, Robin S. -------------------------- Show quote "JerryWEC" <JerryWEC@newsgroups.nospam> wrote in message news:elW4npwGHHA.4652@TK2MSFTNGP04.phx.gbl... > Adriano, this works good! Thanks a lot! > > JerryM > RobinS
here is the code I ended up with to set the num lock and caps lock.... Private Sub SetStatusLabels() Try Me.sslNumLock.Text = IIf(My.Computer.Keyboard.NumLock(), "Num On", "Num Off") Me.sslCapsLock.Text = IIf(My.Computer.Keyboard.CapsLock(), "Caps On", "Caps Off") Catch ex As Exception ParentLogging.ProcessException(ParentLogging.CurrentMethodName(), ex) End Try End Sub Thanks!
Robin S. -------------------- Show quote "JerryWEC" <JerryWEC@newsgroups.nospam> wrote in message news:eUngVBTHHHA.4712@TK2MSFTNGP04.phx.gbl... > RobinS > > here is the code I ended up with to set the num lock and caps lock.... > > Private Sub SetStatusLabels() > > Try > > Me.sslNumLock.Text = IIf(My.Computer.Keyboard.NumLock(), "Num > On", "Num Off") > > Me.sslCapsLock.Text = IIf(My.Computer.Keyboard.CapsLock(), > "Caps On", "Caps Off") > > Catch ex As Exception > > > ParentLogging.ProcessException(ParentLogging.CurrentMethodName(), ex) > > End Try > > End Sub > > |
|||||||||||||||||||||||