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

Character Position in TextBox

In my Textbox, User will input a date e.g "2004-12-06"
How can I check the curosr position if the user use mouse or arrow to move
the cursor position in the textbox ?
e.g "2004-12-06" if user move the cursor and delete "2" . like this
"2004-1-06"
I need to get know the position just after "1" .... '2004-1"
I need to get the result "6" ,
Does anyone understand my problem ?? Thanks a lot


Nov 21 '05 #1
2 3054
Hello Agnes,
I think you need SelectionStart property of TextBox control
SelectionLenght will show you how many characters are selected - 0 when you
have no seelction
when SelectionLenght is 0 you can check SelectionStart to get possition
of carret

regards

Galin Iliev
MCSD, MCAD.NET
In my Textbox, User will input a date e.g "2004-12-06"
How can I check the curosr position if the user use mouse or arrow to
move
the cursor position in the textbox ?
e.g "2004-12-06" if user move the cursor and delete "2" . like this
"2004-1-06"
I need to get know the position just after "1" .... '2004-1"
I need to get the result "6" ,
Does anyone understand my problem ?? Thanks a lot


Nov 21 '05 #2
"Agnes" <ag***@dynamictech.com.hk> schrieb:
In my Textbox, User will input a date e.g "2004-12-06"
How can I check the curosr position if the user use mouse or arrow to move
the cursor position in the textbox ?
e.g "2004-12-06" if user move the cursor and delete "2" . like this
"2004-1-06"
I need to get know the position just after "1" .... '2004-1"
I need to get the result "6" ,
Does anyone understand my problem ?? Thanks a lot


Take a look at the 'SelectionStart'/'SelectionLength'/'SelectedText'
properties. You can use the 'Mid' function or 'String.Substring' to extract
a part of the text.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

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...
1
by: dale zhang | last post by:
Hi, I have a web form page. it has gridlayout and a table at top like a template. When I have the literal or requiredfieldvalidator ErrorMsg displayed, they are all over the page. Is there...
7
by: One Handed Man [ OHM# ] | last post by:
OK, here is a mildy interesting one. What is the cleanest way to do the following. Every time a keyPress event occurs, I wan to check for the quote ( " ) and subsitute it for the apostrophe ( '...
13
by: BluDog | last post by:
Hi I want to be able to work out the character under the mouse as it moves over a TextBox... I was thinking about aproaching it by measuring the string and working it out that way. I am not...
2
by: Nathan Sokalski | last post by:
I have been trying to make a (supposedly) simple control. The control is nothing more than a control used to select integers, I was planning on making it a UserControl composed of a TextBox and 2...
2
by: Dale | last post by:
This seems like it should be simple and I am pretty sure I've done similar things a hundred times before but I sure can't seem to get it right this time. I have a GridView with a column of text...
1
by: =?Utf-8?B?TGkgUWl1?= | last post by:
Hi, I am trying to get the inserting position of a string within a DataGridViewTextBoxCell in editing mode, based on the cursor point position in selection mode. I used the method...
5
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position...
7
kireytir
by: kireytir | last post by:
hi all, this is my code (in interrupt function) for finding character in string (data). Ekle_text.Text += data; string veri = Ekle_text.Text; int found = veri.IndexOf("x"); if (found !=...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.