473,416 Members | 1,648 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,416 software developers and data experts.

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 3797
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
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...
7
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...
0
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...
1
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
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
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...
0
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...
3
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...
6
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.