Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Uriel_96 · Dec 23, 2010 at 07:38 PM · windowsfiledrag-and-dropcs0246

Drag and Drop error

OK, I am doing a C# script about dragging objects from the files to a box(drag and drop files), but the problem is that when I copy this script and save it I get 2 erros saying me:

Assets/Standard Assets/File.cs(5,47): error CS0246: The type or namespace name `DragEventArgs' could not be found. Are you missing a using directive or an assembly reference?

So I don't know what exactly is saying(I dont know what is the error) so I decide to investigate and I found I have to put System.Windows.Forms;(but I am not sure if is that) but I save it and gives me an error that that word dosent exist. Here is the script I copy:

using UnityEngine; using System.Collections; using System; public class File : MonoBehaviour { private void textBox1_DragEnter(object sender,DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; }

private void textBox1_DragDrop(object sender,DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var objPaths = (string[])(e.Data.GetData(DataFormats.FileDrop)); if (objPaths != null && objPaths.Length > 0 && File.Exists(objPaths[0])) { MessageBox.Show(string.Format("Filename: {0}", objPaths[0])); using (TextReader tr = new StreamReader(objPaths[0])) textBox1.Text = tr.ReadToEnd(); } } } }

So please could some one point me in the right direction of I need to do to solve this problem.

Thanks.. In advance.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by _Petroz · Jan 14, 2011 at 04:49 AM

That does not really look like Unity code. A google search for DragEventArgs turned up this: http://msdn.microsoft.com/en-us/library/system.windows.forms.drageventargs.aspx?PHPSESSID=ev0v34i8u80gkmn37sd8r65363

That seems to indicate that the class is in the System.Windows.Forms namespace.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by tylo · Jan 14, 2011 at 03:19 AM

I'm not certain, but you may need to have

using UnityEditor;
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Uriel_96 · Jan 14, 2011 at 03:38 AM 0
Share

good point but is not that I added and the error still there :(

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Open custom file type 1 Answer

Write/Read save files on Windows: MyDocuments vs persistentDataPath 2 Answers

How to save a text file in Windows 8 3 Answers

Standalond built for Windows doesn't include text assets 0 Answers

Save and load prefabs instantiated at runtime 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges