Getting rid of the cursor?

  • Thread starter Thread starter dinny
  • Start date Start date
D

dinny

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
 
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
 
Back
Top