You're have to use the Windows API to do this, hiding and showing the caret
according to TextBox events. See the following:
http://www.pinvoke.net/default.aspx/user32/HideCaret.html
http://www.pinvoke.net/default.aspx/user32/ShowCaret.html

Signature
HTH,
Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
The shortest distance between 2 points is a curve.
> Hi,
>
[quoted text clipped - 12 lines]
>
> Ben
Ben - 12 Feb 2007 17:37 GMT
Hey Kevin,
Thanks a alot,
I'll have a look at that.
Ben
> You're have to use the Windows API to do this, hiding and showing the caret
> according to TextBox events. See the following:
[quoted text clipped - 18 lines]
> >
> > Ben
Ben - 13 Feb 2007 07:59 GMT
HideCaret fails, and when i call Marshal.GetLastWin32Error, it
returns a value of 5, which i think means access denied.
How can i make this work please?
Thanks,
Ben
Mattias Sjögren - 13 Feb 2007 19:33 GMT
>HideCaret fails, and when i call Marshal.GetLastWin32Error, it
>returns a value of 5, which i think means access denied.
>How can i make this work please?
The declaration at pinvoke.net didn't have SetLastError=true in the
DllImport attribute. Did you add that? If not, you can't expect
GetLastWin32Error to return the right error code.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Ben - 13 Feb 2007 21:03 GMT
Hi Mattias,
Yes, I did add "SetLastError=true" to the attribute.
I have no idea why I get access denied when I call HideCaret.
Thanks,
Ben