Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 350071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:31:02+00:00 2026-05-12T11:31:02+00:00

Sampling drag-and-drop between WinForm RichTextBoxes within one application and between them and external applications

  • 0

Sampling drag-and-drop between WinForm RichTextBoxes within one application and between them and external applications revealed two interesting observations (item 1 certainly appears to be a bug; in a perfect world, item 2 would probably be as well):

  1. Some drag-and-drop operations delete the dragged text from the source container, whether or not it is set to read-only. (Thanks to Mark Morgan for first noticing this in his bug report on my open-source site.)
  2. Whether text is retained or deleted from a source container is inconsistent among different applications.

I could not find any definitive reference indicating what drag-and-drop behavior is supposed to be. The closest I found was on page 476 of the Windows User Experience Interaction Guidelines (for Vista):
“Dragging and dropping: Object is moved or copied to the drop target”. Well, that certainly aligns with my observations; some applications move the object, others copy it!

The questions: I would like to find a workaround for item 1 above; it irks me that a read-only container is not inviolate! As a secondary question, I am wondering if someone has a reference to how drag-and-drop is supposed to behave? When is it a move and when is it a copy?

My sample WinForm application (code below) contains two RichTextBox controls, the left one being read-only (call this RTB1) and initialized with some text; the right one (RTB2) being read/write so it may receive text. Both have drag-and-drop enabled for the test. Here are the combinations I tested; notice that in each grouping there is at least one “odd-man-out” :


  1. From RTB1 to RTB2: move
  2. From RTB1 to other RTB (external): move
  3. From RTB1 to WordPad: copy
  4. From RTB1 to Word2003: move
  5. From RTB1 to Outlook2003: copy
  6. From RTB1 to Firefox3.0: copy


  7. From RTB2 to other RTB (external): move

  8. From RTB2 to WordPad: copy
  9. From RTB2 to Outlook2003: copy
  10. From RTB2 to Firefox3.0: copy


  11. From Outlook2003 to RTB2: move

  12. From WordPad to RTB2: move
  13. From Word2003 to RTB2: move
  14. From other RTB (external) to RTB2: move
  15. From Firefox3.0 to RTB2: copy


  16. From Word2003 to Outlook2003: copy

  17. From Outlook2003 to Word2003 : move

Tests run on WinXP.
Test app compiled with .NET 2.0 (tried a couple with .NET 3.5 with the same results).


Here is the sample application:

using System;
using System.Windows.Forms;

namespace RichTextBoxTest
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }

    partial class Form1 : Form
    {

        private RichTextBox richTextBox1 = new RichTextBox();
        private RichTextBox richTextBox2 = new RichTextBox();

        public Form1()
        {
            InitializeComponent();
        }

        private System.ComponentModel.IContainer components = null;

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // richTextBox1
            // 
            this.richTextBox1.EnableAutoDragDrop = true;
            this.richTextBox1.Location = new System.Drawing.Point(34, 25);
            this.richTextBox1.ReadOnly = true;
            this.richTextBox1.Size = new System.Drawing.Size(122, 73);
            this.richTextBox1.Text = "some stuff here";
            // 
            // richTextBox2
            // 
            this.richTextBox2.EnableAutoDragDrop = true;
            this.richTextBox2.Location = new System.Drawing.Point(177, 25);
            this.richTextBox2.Size = new System.Drawing.Size(122, 73);
            this.richTextBox2.Text = "";
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(338, 122);
            this.Controls.Add(this.richTextBox2);
            this.Controls.Add(this.richTextBox1);
            this.Text = "Form1";
            this.ResumeLayout(false);
        }
    }
}
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:31:02+00:00Added an answer on May 12, 2026 at 11:31 am

    Having had no tidbits submitted on this I delved further into the issue.

    First, I obtained some information from Microsoft (via MSDN support) that standard drag-and-drop behavior does a move while holding down Control with drag-and-drop does a copy.

    Next, consider these three modes of operation:

    1. User can edit text.
    2. User can move text (via drag-and-drop).
    3. Application can change text programmatically.

    According to Microsoft, setting read-only disables only item (1) ! To also honor read-only for item (2) one must manually code the solution rather than using the read-only property.

    Well, to me this is clearly a defect. I believe read-only should disable both (1) and (2). So I submitted an official defect report to Microsoft Connect espousing this opinion. Alas, the response came back as essentially “Thanks, but not important enough issue to fix.” Sigh…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 360k
  • Answers 360k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Hmm, does not hte value of @question stay the same?… May 14, 2026 at 2:47 pm
  • Editorial Team
    Editorial Team added an answer Here you can download "Email Reporter: VSTS 2008 Load Test… May 14, 2026 at 2:47 pm
  • Editorial Team
    Editorial Team added an answer Although this may be possible somehow, I would recommend not… May 14, 2026 at 2:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.