By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,103 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Getting rid of the cursor?

P: n/a
I have a form and a multiline textbox with a message.
The problem is that I can see the cursor, is there any
way so move the focus away from the textbox so that
I don't see the cursor on the form (unless someone
actively clicks on the form, that is ok)

I tried this, but it didn't work

Public Declare Auto Function HideCaret Lib "user32.dll" ( _
ByVal hwnd As IntPtr) As Boolean
Private Sub About_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Select(1000, 0)
HideCaret(TextBox1.Handle)
End Sub

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dinny,
By cursor I presume you really mean Caret, as a TextBox has both a Cursor &
a Caret!

Be certain to read the Win32 help on HideCaret & its companion ShowCaret.
They only work when the control itself owns the Caret. If the Form.Load
event the TextBox does not yet own the Caret. The TextBox owns the Caret
when it gets focus...

For a discussion on showing & hiding the Caret in a VB.NET application,
along with a handy Caret class, see Charles Petzold's book "Programming
Microsoft Windows with Microsoft Visual Basic .NET" from MS Press.

Hope this helps
Jay

"dinny" <nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a form and a multiline textbox with a message.
The problem is that I can see the cursor, is there any
way so move the focus away from the textbox so that
I don't see the cursor on the form (unless someone
actively clicks on the form, that is ok)

I tried this, but it didn't work

Public Declare Auto Function HideCaret Lib "user32.dll" ( _
ByVal hwnd As IntPtr) As Boolean
Private Sub About_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Select(1000, 0)
HideCaret(TextBox1.Handle)
End Sub

Nov 21 '05 #2

P: n/a
Yes, thank you. Just needed to move it to TextBox1_GotFocus
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.