hi again guys,

i want to automatically turn on the caps lock when the cursor is focused on a certain textbox..

please help..i am doing a school project and i badly need all you help guys..thanks.

here is the complete code:

i only have one button on my form:

Imports System.Runtime.InteropServices
Public Class Form1
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
    Private Const VK_CAPITAL As Integer = &H14
    Private Const KEYEVENTF_EXTENDEDKEY As Integer = &H1
    Private Const KEYEVENTF_KEYUP As Integer = &H2
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        keybd_event(VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0)
        keybd_event(VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
    End Sub
End Class

How about turning off the caps lock? Thanks..:)

just press the button again and it will turn off

hello .. if u just want user to enter text in caps then use following property of TextBox

me.TextBox1.CharacterCasing = CharacterCasing.Upper

here's the situation, i only want to turn on the caps lock when lets say txtMI is focused..else, when the focus is in txtFName, the capslock will be turned off..

thank you thank you...:)


me.TextBox1.CharacterCasing = CharacterCasing.Upper <---this works better..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.