0

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.

2
Contributors
7
Replies
9
Views
6 Years
Discussion Span
Last Post by airesh
0

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
0

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

me.TextBox1.CharacterCasing = CharacterCasing.Upper
0

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..

0

thank you thank you...:)


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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.