473,786 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textbox cursor Point.

Hi to all,

we have the MousePosition property that we can get the Point of the position
of the mouse cursor on the screen, but is it there a way to get the
respective Point
of a cursor in a TextBox ?? (relative to screen)

I mean, i have a textbox that i write some text and i want to know the exact
point location
of the cursor at any time a character is displayed.

Is there a way to do this ??
Thanks a lot for any help
Nov 17 '05 #1
1 3889
Directly no... however with a little math and some crazy-go-nuts code... kinda.

Locating the cursor position within the text box (row and column) would be
possible by doing some work with the SelectionStart property and Lines...
however that would be insufficient as it would not tell you exactly where you
are in the TextBox due to the potential for scrolling.

With scrolling in the picture, the answer is ultimately no, as you have no
good way of knowing exactly within the textbox where you are and where that
relates to the rest of the control.

Without scrolling, you can do some math based on the row/column position
within the textbox and the font in use to calculate the position, this method
should still work even if you are not using a fixed width font given that the
rows are already specified. From that, it would be simple math to determine
the position further by throwing in the TextBox’s position on the form and
the forms position within Windows.

Brendan
"objectref" wrote:
Hi to all,

we have the MousePosition property that we can get the Point of the position
of the mouse cursor on the screen, but is it there a way to get the
respective Point
of a cursor in a TextBox ?? (relative to screen)

I mean, i have a textbox that i write some text and i want to know the exact
point location
of the cursor at any time a character is displayed.

Is there a way to do this ??
Thanks a lot for any help

Nov 17 '05 #2

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

Similar topics

1
2944
by: M Wells | last post by:
Hi All, I've been checking the online javascript libraries for code that will show me how to insert characters at the current cursor point in a textarea form field to help me markup content I write for my site. Unfortunately, all I've been able to locate are plugin applets that give wysiwig functionality, which is not what I'm looking for. So I'm wondering if someone can provide some code, or point me to some
7
9063
by: Steve | last post by:
does any one know a way to determine the position of the cursor in a text box. I would like to position a list next to the current position for context commands. I am using VS.NET/C#/System.Windows.Forms.
0
831
by: Judith Stanley | last post by:
Hi Guys and Gals, I don't like the way my ASP.NET page behaves. I have created a simple survey and there are several places where I have multi-line text boxes for comments. I have gotten several complaints that when someone types in a text box and then places the cursor in the next text box and starts typing, what they type ends up in the first text box as if the click in the other text box never happened. I had to put a statement at...
1
2411
by: Will Lastname | last post by:
I am trying to place the cursor's default position into a certain textbox on each postback. I have only found Javascript and C# examples so far. Any VB.NET suggestions?
2
1377
by: Tom | last post by:
Hi Can anyone tell me if it is possible to get the position within a textbox of the character under the mouse when it hovers over the textbox in question? Thanks Tom
3
7332
by: johnk | last post by:
Hi, I am trying to get a textbox in a form to display a partial item entry, i.e. "WER-5-" as most item serial numbers contian this value. I want the cursor at the end of this text but it is always at the beginning. How do I get it at the end. I remember at one faking character input to do something similar but can't remember how I did it.
0
2303
by: Mehina | last post by:
i am having a problem regarding the disappearance of the cursor in the DataGrid cell after i change the width of the column on runtime.here is a function which is being called in the Textchanged handler of the embedded Textbox of DataGrid Cell. Private Sub UpgradeGridColumns() Dim colText As String Dim currColumn As DataColumn Dim currColStyle As DataGridTextBoxColumn Dim ColumnStyle As...
3
12005
by: fbergroth | last post by:
Hi, I'm quite new to C# allthough I've been programming in other languages for quite a while. I'd like to change the blinking cursor inside a TextBox, I guess I must derive the class and override the OnPaint()-method, however I have no clue what to do next. I want to be able to switch the blinking cursor to a solid, non-blinking, cursor and preferable have it with a color. So, how should I do that?
6
1630
by: charvi | last post by:
i have a text box in which i have a sentence as hi good morning.now i want the cursor at the enof word morning in text box how to do
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.