?
Solved

Hide the cursor int the textBox.

Posted on 2000-02-22
5
Medium Priority
?
1,409 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 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