473,695 Members | 2,372 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 3866
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
2929
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
9055
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
821
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
2405
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
1374
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
7321
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
2296
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
11979
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
1614
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
8631
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
8572
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8847
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
8825
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
7661
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6491
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4340
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...
0
4579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3003
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.