• 0

[vb .net 2.0]RichTextBox Drag & Drop from explorer


Question

Ok, I have a slight issue and for some reason I am not able to resolve it. I have a parent form with a drag and drop event to open files dragged from explorer into a new child form, it works fine. I also have children forms with a rich text box (txtMain) filling the entire form. I took the very same code from the main form and just put it into the drag and drop events for txtMain. It works as well, the new child form is opened and its txtMain is filled with the information from the text file. It works fine, with one exception, it leaves a boxed link with the text "Text File" in the txtMain into which the file was originally dragged. How can I prevent it from doing this while still doing every thing else?

This problem only happens in 2.0 and not 1.1. I'm guessing the rich text box control was altered a bit.

21 answers to this question

Recommended Posts

  • 0
Ok, I have a slight issue and for some reason I am not able to resolve it. I have a parent form with a drag and drop event to open files dragged from explorer into a new child form, it works fine. I also have children forms with a rich text box (txtMain) filling the entire form. I took the very same code from the main form and just put it into the drag and drop events for txtMain. It works as well, the new child form is opened and its txtMain is filled with the information from the text file. It works fine,  with one exception, it leaves a boxed link with the text "Text File" in the txtMain into which the file was originally dragged. How can I prevent it from doing this while still doing every thing else?

This problem only happens in 2.0 and not 1.1. I'm guessing the rich text box control was altered a bit.

584867028[/snapback]

If you think it's a bug, submit it here http://lab.msdn.microsoft.com/productfeedback/Default.aspx

They'll reply back to you if it's By Design or if they've fixed it. Also, have you downloaded the newest drop (October)?

  • 0

No, I haven't downloaded the newest. You have al ink?

Also, it doesn't seem to be a bug, just an enhanced functionality that needs to be worked around or something because if you doble click the box, it opens the file as though you double clicked it in explorer.

  • 0
I found and tried installed the refresh, but everytime I do, it just crashes with one of those "send error report" errors.

584870000[/snapback]

Did you follow the installation instructions (uninstalling this and that) before trying to install it?

  • 0
Did you follow the installation instructions (uninstalling this and that) before trying to install it?

584870601[/snapback]

Where are those?

Are you mousing over the top standard toolbar in VS 2005? It crashes when you do.

584870661[/snapback]

In BETA 1? Doesn't happen for me.

  • 0

You can download the software here:

http://lab.msdn.microsoft.com/vs2005/downloads/default.aspx

And you can view the readme here:

http://lab.msdn.microsoft.com/express/read...04/default.aspx

Unfortuantly, the October drop isn't as stable as other drops. They just wanted to refresh a few features (like Edit & Continue for C#!). December should roll out a really nice release.

  • 0
Nah, the one that came out in Oct. Technical Preview Release. Is that the one your using? It crashes alot.

584871610[/snapback]

well I installed and it doesn't crash but it also gives me an error when trying to open a form in designer mode, can only view the code.

  • 0

thats actually a known bug.. I can recall reading about it on the Visual Studio Express blog site. they have no fix for it and they say it has to do with previous version of the 2.0 framework being installed. They said there is no resolve for it but they do know its there. Also can you post a pic of the mess

  • 0

why not have it so that it drags into the MDI parent window and then opens up an instance of the txtMain... Or is that what you are already doing ? didn;t sound to clear. Sounds like your dragging the txt files onto the richtextbox and they open up and then your dragging that info from one box to the other child window. correct ?

  • 0
why not have it so that it drags into the MDI parent window and then opens up an instance of the txtMain... Or is that what you are already doing ? didn;t sound to clear. Sounds like your dragging the txt files onto the richtextbox and they open up and then your dragging that info from one box to the other child window. correct ?

584872829[/snapback]

Well, if the child form is maximized, I want it to be able to still detect the drag and drop. So I have drag and drop on for both the richtextbox in the child form and the mdi parent.

How are you reading the text files? streamreader?

Should try streamreading on drag and drop.

584873756[/snapback]

yes, using a streamreader.

  • 0

Due to the crappy documentation, I'm not able to find a definitive answer, but I saw that you posted on the newsgroup.

I suspect that the CreateRichEditOleCallback has something to do with it always linking/embedding the file into the control. If you create your own custom RichEdit contro(via inheritance)l and override that method, you'll have to create your own drag-n-drop code as all d-n-d events won't be raised(according to what little docs there are).

  • 0
oh man that's just a bitch and a half

584875379[/snapback]

There might be a work around. It may involve SendMessage. :)

If you look at wordpad, which uses the RichText control, you'll see the same behavior. It could be that this control isn't near being finished. I would think that MS will provide a way to cancel an OLE event if you handle the DragDrop event.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.