Solved

Hide the cursor int the textBox.

Posted on 2000-02-22
5
1,362 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

867 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

20 Experts available now in Live!

Get 1:1 Help Now