473,405 Members | 2,294 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,405 software developers and data experts.

Textchanged event, controlling editor cursor position

Hi

I have to change automatically the text inside a textbox.
I need to add thousand separator when I am writting in the textbox.
I am using TextChanged event and when I insert a new number, i have a
function that formats the complete text with thousand separator.

For example, if textbox1 content is 1,234 and i added a number 5 after
number 1, the result must be 15,234.

The problem is that I can not control editor curso position. Each time
TextChanged is called, the cursor places at the beginning of the
textbox.

I need to place the cursor at the last position where i write the new
number.

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
3 5157
Adriana Camargo wrote:
Hi

I have to change automatically the text inside a textbox.
I need to add thousand separator when I am writting in the textbox.
I am using TextChanged event and when I insert a new number, i have a
function that formats the complete text with thousand separator.

For example, if textbox1 content is 1,234 and i added a number 5 after
number 1, the result must be 15,234.

The problem is that I can not control editor curso position. Each time
TextChanged is called, the cursor places at the beginning of the
textbox.

I need to place the cursor at the last position where i write the new
number.

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***


Use the Textbox.SelectionStart and Textbox.SelectionLength properties.

Chris
Nov 21 '05 #2
But when i changed the text in the textbox, Textbox.SelectionStart is
always 0, and I can't retrieve the last one.
Adris Vb.net

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #3
Adris wrote:
But when i changed the text in the textbox, Textbox.SelectionStart is
always 0, and I can't retrieve the last one.
Adris Vb.net

*** Sent via Developersdex http://www.developersdex.com ***


you will have to save where it is in the keypress event before you let
them type.

Chris
Nov 21 '05 #4

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

Similar topics

3
by: Fabrício de Novaes Kucinskis | last post by:
Hi all, I have a combobox control, in wich I put an autocomplete code. This code is in the TextChanged event, but when this event fires, the Text property isn't updated yet. For example, if...
2
by: Terry Murray | last post by:
I have been given the task of adding a component to a control panel that will act as a miniature html editor. I would like to know how to determine the position of the cursor at any point within a...
4
by: Francesco | last post by:
Hi all, I am trying to make a UserControl with a TextBox in it. I have to publish the TextChanged event of the inner TextBox, but I have some trouble. If I declare : public event EventHandler...
3
by: Mark A | last post by:
In the DB2 Admin Client (8.2.4), when the results of a query are displayed in the grid that looks like a spreadsheet (using Command Editor or double click on table name in Control Center). The data...
1
by: Mario Figueiredo | last post by:
Hello everyone, I'm having trouble controlling the cursor position when I make two consecutive calls to the get family of functions. This problem does not happen if there is an output in...
1
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've panel in my windows form, and i want to get the exact mouse position when i double click. I used: Point p = this.panel1.PointToClient(Cursor.Position); but now, if i'm pointing on...
4
by: dadonz | last post by:
I have a web application in C# project using a free text editor. I want to insert links/text/images into the cursor position in the text editor. Could anyone advise me how to get the current...
3
by: SimonG via AccessMonster.com | last post by:
Hi, I would like to be able to compare a control's new value with its old value, whenever it is changed by a user. The control holds a numeric value, qty_Sold, when this value changes I need to...
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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
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...

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.