473,499 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox Question

Hi there, I'm new in c# and need to know how to get the position of the
cursor in a textbox control.

For example, let be the text : "My text", if the cursor position is behind
the "x", then the position is 5.
Thanks a lot.

--
*** Ygnacio Durán ***


Nov 15 '05 #1
4 11892
SelectionStart.

"Ygnacio Durán" <yduranArrobAmixmail.com> wrote in message
news:#2**************@TK2MSFTNGP10.phx.gbl...
Hi there, I'm new in c# and need to know how to get the position of the
cursor in a textbox control.

For example, let be the text : "My text", if the cursor position is behind
the "x", then the position is 5.
Thanks a lot.

--
*** Ygnacio Durán ***

Nov 15 '05 #2
Check out the SelectionStart property.

- Pete
"Ygnacio Durán" <yduranArrobAmixmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi there, I'm new in c# and need to know how to get the position of the
cursor in a textbox control.

For example, let be the text : "My text", if the cursor position is behind
the "x", then the position is 5.
Thanks a lot.

--
*** Ygnacio Durán ***

Nov 15 '05 #3
On Mon, 2 Feb 2004 17:09:46 -0400, "Ygnacio Durán" <yduranArrobAmixmail.com> wrote:
Hi there, I'm new in c# and need to know how to get the position of the
cursor in a textbox control.

For example, let be the text : "My text", if the cursor position is behind
the "x", then the position is 5.


It sounds like you're off on a bad idea, The position you describe
would be 6 not 5, but see the documentation for TextBox.SelectionStart
property.

regards,

bullshark

Nov 15 '05 #4
In his descriptions, he assumed the first character might have been at
position zero rather then one. Who among us have not maid an indexing
mistake. :)

"bullshark" <bu*******@scubadiving.com> wrote in message
news:at********************************@4ax.com...
On Mon, 2 Feb 2004 17:09:46 -0400, "Ygnacio Durán" <yduranArrobAmixmail.com> wrote:
Hi there, I'm new in c# and need to know how to get the position of the
cursor in a textbox control.

For example, let be the text : "My text", if the cursor position is behindthe "x", then the position is 5.


It sounds like you're off on a bad idea, The position you describe
would be 6 not 5, but see the documentation for TextBox.SelectionStart
property.

regards,

bullshark

Nov 15 '05 #5

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

Similar topics

2
8374
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
5387
by: Devinim ÞÖLEN | last post by:
Hi; I try to fetch data and show in the textbox as follows; .. .. .. .. <asp:XmlDataSource Id="m_ChXmlDataSource" runat="server"...
3
1687
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
2
2078
by: Jon | last post by:
Hello All, I have a datalist whose itemtemplate contains a label and a textbox. The label text is set on itemdatabound with the text, which is a question, from the database column. Each question...
0
1371
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
1
1470
by: melanieab | last post by:
Hi, If there's a textbox and the text entered is longer than what's visible (the textbox length), how do you make it so that the beginning chunk of text is visible (instead of the last part of...
13
3306
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
1
3191
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
10
2437
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
4
3687
by: Randy | last post by:
My situation is that I have a form on which a number of textboxes and comboboxes are added dynamically based on interaction with the user. As these controls are added, they are given names based on...
1
6893
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...
0
7386
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
5468
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,...
1
4918
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...
0
4599
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...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
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...

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.