For a string that is being edited in a textbox, is there a way to find
the position of the edit cursor in the string being edited? For
example, it would be 0 or 1 at the beginning of a string and go up by
one each time the right arrow key was pressed.
Thanks Much,
Gene in NC 2 2132
The SelectionStart property of the textbox should give you the position of
the cursor. You should also check the SelectionLength property as this will
tell you if the use has selected an area of the text and not just placed the
cursor in the textbox.
Kirk
TextBox1.Select ionStart
"Gene Hubert" <gw******@hotma il.com> wrote in message
news:7e******** *************** **@posting.goog le.com... For a string that is being edited in a textbox, is there a way to find the position of the edit cursor in the string being edited? For example, it would be 0 or 1 at the beginning of a string and go up by one each time the right arrow key was pressed.
Thanks Much, Gene in NC
Hey Gene -
This little snippit should help:
Private Sub TextBox1_KeyUp( ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles TextBox1.KeyUp
Debug.WriteLine (TextBox1.Selec tionStart())
End Sub
Josh Moody
VSU Team
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
-------------------- From: gw******@hotmai l.com (Gene Hubert)
For a string that is being edited in a textbox, is there a way to find the position of the edit cursor in the string being edited? For example, it would be 0 or 1 at the beginning of a string and go up by one each time the right arrow key was pressed.
Thanks Much, Gene in NC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jason |
last post by:
I've got this javascript routine (i found on google - thank you) in an
asp.net page that on page reload sets the cursor of a textbox to the
last line. It works great!
Using a similar concept, I have another application that uses a
textbox like an editor window and has a save and other buttons.
Problem is - when I save/post/reload, the textbox returns to cursor
the top again.
How can I preserve / save the exact cursor spot and return...
|
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.
|
by: Jed Ozone |
last post by:
In a TextBox, I'm using a MouseMove event to track the cursor position.
I want to get able to tell what text the current cursor position is at so I
can set the SelectionStart to that position.
private void textBox1_MouseMove(object sender, MouseEventArgs e)
{
Point p = textBox1.PointToClient(new Point(e.X, e.Y));
/* now what to do I do with Point to figure out the character
position in the text box??? */
|
by: DaveR |
last post by:
Can anybody help me to a)get the user's cursor insertion point (caret)
from a multiline textbox, using client-side script I suppose, and then
b)return the position to VB code behind?
I have tried the following client-side function suggested on this
Google Group (thank you) but I'm not sure what it's doing or how to
return the caret position to code behind ("txtReading" is the Textbox
ID):
function getcaretpos(txtReading)
|
by: Neil Robbins |
last post by:
Could anyone suggest a way in which I could find the position of the cursor
within a textbox.
I want to evaluate every keypress made within the textbox in order to
validate it but in order to do this I need to know where the cursor is when
the key is pressed. So far I can't see how I could do this.
Any help would be very much appreciated,
Neil R.
| |
by: Agnes |
last post by:
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
|
by: Adriana Camargo |
last post by:
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.
|
by: Brandon McCombs |
last post by:
Does anyone know of an easy way to set the position of the cursor in a
TextBox? If I set text in the box that is longer than the length of the
TextBox the position of the cursor is at the very end of the line and a
user would have to use the arrow keys to move it back to the beginning
of the line of text. I'd prefer to set the cursor position automatically
to just before the first character of the text.
thanks
|
by: dj12345 |
last post by:
i have function to make character in lowercase if a text is in uppercase
function upperCase(x)
{
try
{
var y=document.getElementById(x).value;
document.getElementById(x).value=y.toLowerCase();
}
|
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...
|
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,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |