473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Remove Caret from textbox

Hello

I am trying to remove the caret (i.e. the blinking bar) from a textbox.
Anyone knows the trick to do this please?

Thanks and Regards
J

--
Before God we are equally wise and equally foolish.
-- Albert Einstein
Nov 16 '05 #1
2 14076
J,

You should be able to call the HideCaret API function through the
P/Invoke layer, passing the handle to the textbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MalteseFalcon" <Ma***********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
Hello

I am trying to remove the caret (i.e. the blinking bar) from a textbox.
Anyone knows the trick to do this please?

Thanks and Regards
J

--
Before God we are equally wise and equally foolish.
-- Albert Einstein

Nov 16 '05 #2
Thanks, the code is as follows:

You need to make this declaration in order to use the P/Invoke Layer

// P/Invoke to hide caret
[DllImport ( "User32.dll" )]
static extern Boolean HideCaret ( System.IntPtr hWnd );

All that remains then is to call the function like so from your method:

HideCaret ( tbConsole.Handle );

Do not forget the following using clause, otherwise you get a compile-time
error:

using System.Runtime.InteropServices;

By the way, thanks very much for the answer.

Regards
Joseph.

"Nicholas Paldino [.NET/C# MVP]" wrote:
J,

You should be able to call the HideCaret API function through the
P/Invoke layer, passing the handle to the textbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MalteseFalcon" <Ma***********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
Hello

I am trying to remove the caret (i.e. the blinking bar) from a textbox.
Anyone knows the trick to do this please?

Thanks and Regards
J

--
Before God we are equally wise and equally foolish.
-- Albert Einstein


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry | last post by:
Retoring Caret Position after text field correction -------------------------------------------------------------------------------- Hi, my code has the following form - function...
3
by: Dayne | last post by:
I would like to create a box-like caret for a textbox(vb.net) . Any idea. Sample code would be nice. DT
3
by: Emmet Cummings | last post by:
Does anyone know how to determine the Caret position in textbox? Thanks, Em
6
by: kurotsuke | last post by:
Hi, I need to know the position (X, Y cohordinates) of the caret. I'm using the function: private static extern int GetCaretPos(ref POINT lpPoint); I'm actually getting a result but I...
2
by: DaveR | last post by:
Can anybody help me to a)get the user's cursor insertion point (caret) from a multiline textbox, using client-side script I suppose, and then b)return the position to VB code behind? I have...
6
by: Marc Robitaille | last post by:
Hello group, I need to remove the caret from the texbox. I tried with the HideCaret API and it doesn't work. Is there a way to hide it? if yes, Is it possible to show me how? Or if you have a...
0
by: Oenone | last post by:
I would like to set the caret position in a (single-line) textbox to a position based on the number of pixels from the left of the control. For example, I want the caret to be positioned 50...
4
by: Ben R. | last post by:
Hi there, I'm designing a winforms app in VB.NET 2.0 and have a textbox control and also some toolbar buttons. I want to have it such that when the user clicks a toolbar button, some predefined...
4
by: Jeannot | last post by:
VS2008, VB, .NET 3.5 When I create a TextBox in Designer, then at runtime wherever I click, the caret is placed at the end of the text the box actually contains. But when I create a TextBox...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.