Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hide the cursor int the textBox.

Posted on 2000-02-22
5
Medium Priority
?
1,437 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 800 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

636 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