• 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.
  • Posts

    • I don't hate the new menus, I am not a fan of the lack of features and how they went live when they clearly are not complete. The menu itself presents much better than the previous - but what's lacking (IMO) is: 1) Any kind of automated manipulation such as: "this goes on the new menu because you use this feature more often on this filetype" "this is rarely used and will fall back to the old menu" 2) Any kind of user manipulation such as: "a UI to add/remove/order items to the new menu"
    • The biggest issue in this version of Win 11 context menu, from usability standpoint, is the movable row with basic commands. Think of a car analogy...if You turn the week left the infotainment screen will move right and vice versa. With how it works now Microsoft made something forbidden in designing in any UI, software or hardware. I can't grasp who were the morons within Microsoft suggesting it was a good idea and gave it a green light.
    • LibreOffice 26.2.4 by Razvan Serea LibreOffice is the free power-packed Open Source personal productivity suite for Windows, Macintosh and Linux, that gives you six feature-rich applications for all your document production and data processing needs: Writer, Calc, Impress, Draw, Math and Base. Support and documentation is free from our large, dedicated community of users, contributors and developers. You, too, can also get involved! Choosing Between LibreOffice Still and LibreOffice Fresh: LibreOffice Still is a good choice if you value stability, a longer support cycle, and a more conservative approach to software updates. It's suitable for businesses and organizations where reliability and compatibility are crucial. LibreOffice Fresh is ideal if you're an enthusiast or an early adopter who wants to stay on the cutting edge of LibreOffice development and is willing to accept more frequent updates and occasional minor issues. Features: Writer is the word processor inside LibreOffice. Use it for everything, from dashing off a quick letter to producing an entire book with tables of contents, embedded illustrations, bibliographies and diagrams. The while-you-type auto-completion, auto-formatting and automatic spelling checking make difficult tasks easy (but are easy to disable if you prefer). Writer is powerful enough to tackle desktop publishing tasks such as creating multi-column newsletters and brochures. The only limit is your imagination. Calc tames your numbers and helps with difficult decisions when you're weighing the alternatives. Analyze your data with Calc and then use it to present your final output. Charts and analysis tools help bring transparency to your conclusions. A fully-integrated help system makes easier work of entering complex formulas. Add data from external databases such as SQL or Oracle, then sort and filter them to produce statistical analyses. Use the graphing functions to display large number of 2D and 3D graphics from 13 categories, including line, area, bar, pie, X-Y, and net - with the dozens of variations available, you're sure to find one that suits your project. Impress is the fastest and easiest way to create effective multimedia presentations. Stunning animation and sensational special effects help you convince your audience. Create presentations that look even more professional than the standard presentations you commonly see at work. Get your collegues' and bosses' attention by creating something a little bit different. Draw lets you build diagrams and sketches from scratch. A picture is worth a thousand words, so why not try something simple with box and line diagrams? Or else go further and easily build dynamic 3D illustrations and special effects. It's as simple or as powerful as you want it to be. Base is the database front-end of the LibreOffice suite. With Base, you can seamlessly integrate into your existing database structures. Based on imported and linked tables and queries from MySQL, PostgreSQL or Microsoft Access and many other data sources, you can build powerful databases containing forms, reports, views and queries. Full integration is possible with the in-built HSQL database. Math is a simple equation editor that lets you lay-out and display your mathematical, chemical, electrical or scientific equations quickly in standard written notation. Even the most-complex calculations can be understandable when displayed correctly. E=mc2. LibreOffice also comes configured with a PDF file creator, meaning you can distribute documents that you're sure can be opened and read by users of almost any computing device or operating system. LibreOffice also comes configured with a PDF file creator, meaning you can distribute documents that you're sure can be opened and read by users of almost any computing device or operating system. Download: LibreOffice 64-bit | LibreOffice 32-bit ~300.0 MB (Open Source) View: LibreOffice Website | Screenshot | Release Notes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Amazon eero Pro 6E mesh Wi-Fi system 2-pack is 27% off by Ivan Jenic The Amazon eero Pro 6E mesh Wi-Fi system is currently $239.99 on Amazon for the 2-pack, down from $329.99. That's 27% off and $90 saved for a solid Wi-Fi solution that covers your entire home (purchase link down below). The 2-pack covers up to 4,000 square feet (372 square meters) and supports 100+ connected devices, which handles the vast majority of home setups without breaking a sweat. Wi-Fi 6E brings access to the 6 GHz band for lower latency across the network, and the 2.5 Gb Ethernet port supports gigabit+ internet plans if your ISP offers them. eero's TrueMesh technology handles traffic routing automatically, so you're not manually managing which devices connect to which node. You set up the entire thing through the eero app, and the entire process takes a few minutes. The system also receives automatic security updates in the background, so once you set it up, you don't have to worry about compatibility issues. If you're covering a larger home or want more nodes, the 3-pack is $329.99 and the 4-pack is $479.98, both at similar discount levels. It's worth mentioning that a newer model exists, which is likely the reason for the discount, but the Pro 6E is still perfectly capable hardware for most homes. Amazon eero Pro 6E mesh Wi-Fi system 2-pack - $239.99 | 27% off on Amazon This Amazon deal is US-specific and not available in other regions unless specified. This is a first-party seller link (at the time of article publishing); ensure that you also purchase from a first-party seller link only. If you don't like it or want to look at more options, check out the previous deals that we have covered, OR you can also visit Amazon US deals page. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Week One Done
      I2D earned a badge
      Week One Done
    • Week One Done
      Dr Jared Dental Studio earned a badge
      Week One Done
    • Week One Done
      RG INVESTMENT GROUP earned a badge
      Week One Done
    • Very Popular
      The Norwegian Drone Pilot earned a badge
      Very Popular
    • Very Popular
      s0nic69 earned a badge
      Very Popular
  • Popular Contributors

    1. 1
      +primortal
      484
    2. 2
      PsYcHoKiLLa
      258
    3. 3
      Skyfrog
      84
    4. 4
      FloatingFatMan
      64
    5. 5
      Michael Scrip
      63
  • Tell a friend

    Love Neowin? Tell a friend!