473,769 Members | 4,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting and dragging text on a TextBox

Hi,
In a normal Windows.Forms.T extBox 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 4538
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.co m

"Abubakar" <em**********@y ahoo.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi,
In a normal Windows.Forms.T extBox 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.c omwrote in
message news:%2******** ********@TK2MSF TNGP06.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.co m

"Abubakar" <em**********@y ahoo.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>Hi,
In a normal Windows.Forms.T extBox 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
1009
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 main form so that I can put the text of the node into the textbox. However, I can get the main form to 'see' the dragged data by setting it's allowdrop to true, but if i then set it to false and set the textbox's allowdrop to true, it can't drop. ...
4
3164
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! Thanks (again), Melanie
2
1446
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 lot of examples pertaining to dragging and dropping objects within a form, but nothing about dragging external documents over a form. Thanks in Advance, Christian Blackburn
5
7316
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 the Text1_GotFocus event: Text1.SelectionStart = 0 Text1.SelectionLength = Text1.Text.Length However, the text does not get highlighted. It appears to be the
0
1700
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 does not show that the text can be dragged 2. When pressing the mouse button to start a drag the selected text changes - I know this is cause the code does not initiate the dodragdrop until the mouse leaves the control but if I change this then you...
2
2363
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 programmatically? Thanks, JJ
11
1619
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 C, so it has to work, I've built a textbox that accepts files: hMsgBox = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL, 15, 30, 420, 20, hwnd, (HMENU)IDD_MSG_BOX, GetModuleHandle(NULL),...
0
1364
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 functionality would definitely be convenient. A guy who is a big time authnor of Access books has published a few articles describing techniques for dragging and dropping data - using VBA but required API code. I think you could drag data from...
0
9422
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,...
0
10208
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9987
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
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 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...
0
8867
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, 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...
1
7404
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 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...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3952
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 we have to send another system
3
2812
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 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...

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.