Solved

Hide the cursor int the textBox.

Posted on 2000-02-22
5
1,358 Views
Last Modified: 2008-03-10
I have many txtBoxes locked. I want to hide the cursor in the txtBox(not the mousePointer) and i want to unhide it when we write inside. Is it possible? is it complicated? If No how we do it?
Code would be appreciate.
0
Comment
Question by:dosyl
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 200 total points
ID: 2547451
Private Declare Function HideCaret Lib "user32" (ByVal hWnd As Long) As Long
Private Sub Text1_GotFocus()
    Call HideCaret(Text1.hWnd)
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2547494
for showing a cursor
Public Declare Function ShowCaret Lib "user32" Alias "ShowCaret" (ByVal hwnd As Long) As Long

for hiding a cursor
Public Declare Function HideCaret Lib "user32" Alias "HideCaret" (ByVal hwnd As Long) As Long

ShowCaret Text1.hwnd ' show a cursor
HideCaret Text1.hwnd  'hide a curosr

Hope this helps you.
0
 
LVL 12

Expert Comment

by:roverm
ID: 2547530
Nice 1 Ruchi!
I always use this 'trick':

I set a tag of a control to 1 or 0 if a text box may be edited.
Then in the Got_Focus event:

Private Sub Text1_GotFocus()
    If MyCheckControl.Tag = "0" Then MyControl.SetFocus
End Sub

So I redirect the focus to a control that MAY have the focus.

But, to be quite honest: I like Ruchi's idea better ! ;-))

D'Mzzl!
RoverM
0
 
LVL 1

Author Comment

by:dosyl
ID: 2547615
Thank's a lot.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2547726
You are welcome, Dosyl.
Thanks, Roverm.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now