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

Selecting and dragging text on a TextBox

Hi,
In a normal Windows.Forms.TextBox control, I want to be able to select a
text (ie highlight, this is by default possible) and than be able to drag
that text through my mouse pointer to another textbox, or any control, than
drop it. How do v do this?

Regards,

...ab
May 8 '07 #1
2 4511
Abubakar,

You will want to check out the section of the MSDN documentation titled
"Performing Drag-and-Drop Operations in Windows Forms", located at:

http://msdn2.microsoft.com/en-us/lib...30(VS.71).aspx

That example is very similar to what you want to do, with a little
tweaking, it should do exactly what you need it to do.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Abubakar" <em**********@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi,
In a normal Windows.Forms.TextBox control, I want to be able to select a
text (ie highlight, this is by default possible) and than be able to drag
that text through my mouse pointer to another textbox, or any control,
than drop it. How do v do this?

Regards,

..ab

May 8 '07 #2
Hi,
I've followed the article and it explains pretty nicely how to do drag n
drop. But there is one thing I'm unable to manage and thats the selecting
and dragging text from TextBox. Its just the selecting from mouse thats a
problem. I highlight from the mouse in a TextBox and thats easy but as soon
as I do a mouse-down on the selected text with tthe purpose of moving it to
the other TextBox, the highlighting is removed and the text cursor starts
blinking exactly in the place where clicked to drag the text out from.
Unable to handle this...

...ab

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP06.phx.gbl...
Abubakar,

You will want to check out the section of the MSDN documentation titled
"Performing Drag-and-Drop Operations in Windows Forms", located at:

http://msdn2.microsoft.com/en-us/lib...30(VS.71).aspx

That example is very similar to what you want to do, with a little
tweaking, it should do exactly what you need it to do.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Abubakar" <em**********@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Hi,
In a normal Windows.Forms.TextBox control, I want to be able to select a
text (ie highlight, this is by default possible) and than be able to drag
that text through my mouse pointer to another textbox, or any control,
than drop it. How do v do this?

Regards,

..ab


May 9 '07 #3

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

Similar topics

0
by: James Slade | last post by:
Hi there, I have a main form with a textbox on it. I have a secondary form that, when a button is clicked on the main form, pops up with a treeview. I want to be able to drag nodes onto the...
4
by: melanieab | last post by:
Hi, I need to write something so that when a textbox is entered (this is for a touchscreen), all the text in that textbox is selected (highlighted) and new keystrokes replace the old text. Help!...
2
by: Christian Blackburn | last post by:
Hi Gang, I would like to be able to drag and drop documents onto my application and have them open immediately thereafter. Can somebody point me towards a KB article or example? I could find a...
5
by: marfi95 | last post by:
I'm very confused. I'm trying to automatically select the text when my textbox gets the focus. This is typically when the user has clicked the mouse in the field. This is the code I have in...
0
by: andytsummers | last post by:
Hi I have tried to implement drag and drop by using the following code but I have several problems. 1. When you put your mouse over selected text the cursor is still the i-beam and therefore...
2
by: JJ | last post by:
I have a textbox that is used to insert some html code. I want to highlight errors in the code, possibly by selecting the text. Is it possible to highlight/select areas of a textbox...
11
by: jon | last post by:
I'm trying to have a section where people can just start dragging files into a textbox and the full location of the file will be stored. MS-Dos has this function built into it, and it's written in...
0
by: Rich P | last post by:
Now your question makes a lot more sense. It sounds like you want to be able to drag a group of records - say - from a subform and drop it into some control for further processing. This kind of...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.