Quick Search for:  in language:    
demonstrates,simple,drag,drop,file,from,windo
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

CString v1.5
By Ultimatum on 7/2


Tablature Pro
By Michael McMullen on 7/2


Click here to see a screenshot of this code!MSN Password Decryptor
By Muhammad Sufyan Ansari on 7/2

(Screen Shot)

Mp3 Paker
By Michael McMullen on 7/2


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Simple ole drag and drop

Print
Email
 

Submitted on: 3/14/2000
By: Stewart MacFarlane  
Level: Beginner
User Rating: By 10 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this code 5220 times.
 
 
     This demonstrates a simple drag and drop of a file from windows explorer into a text box then grab the filename and path (this is part of the code im using to make a map install program for quake2)
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: Simple ole drag and drop
' Description:This demonstrates a simple
'     drag and drop of a file from windows exp
'     lorer into a text box then grab the file
'     name and path (this is part of the code 
'     im using to make a map install program f
'     or quake2)
' By: Stewart MacFarlane
'
' Inputs:a dropped file from windows exp
'     lorer
'
' Returns:incorrect file type
'
' Assumes:you must create a textbox call
'     ed text1 and make sure its big enough so
'     its not too fiddly to drop a file onto. 
'     also make sure for text1 oledragmode and
'     oledrop mode in the properties are set t
'     o manual
'
' Side Effects:none known
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=6598&lngWId;=1'for details.'**************************************

Private Sub text1_OLEDragDrop(Data As DataObject, Effect As Long _

, Button As Integer, Shift As Integer, X As Single, Y As Single) ' Prepare a variable (numfiles) and pass ' the number of files ' dropped onto text1 to this variable Dim numFiles As Integer numFiles = Data.Files.Count ' an example how to trap 1 file (can be ' modified to trap as many ' or as little amount by changing the &g; ' t; 1 to > {new value}) then ' display a message box telling user the ' maximum allowed file drops) ' then exit the sub If numFiles > 1 Then MsgBox "Only allows 1 file at a time In beta version! Sorry!"_ ,vbOKOnly, "Ooops beta version" Exit Sub End If
' check the attributes of the file being ' dropped and see if it is a ' directory, if it is then warn user tha ' t only files are valid to drop ' and exit the sub If (GetAttr(Data.Files(1))) = vbDirectory Then MsgBox "Sorry this beta version only allows files Not directories to be installed" Exit Sub End If
' check the file is the correct file typ ' e (using its extension) ' if not then warn user and exit the sub ' If LCase(Right(Data.Files(1), 3)) <> LCase("bsp") Then MsgBox "This file is Not a quake 2 map (*.bsp)" Exit Sub End If
' tell user the drag and drop was succes ' ful MsgBox Data.Files(1) + " installed" ' code here to install file ' or do what ever you need ' data.files(1) is a string holding the ' path and filename of the dropped file ' using a for..next loop you can control ' multiple files dropped at once ' replacing the 1 with the for..next var ' iable and using numfiles to find out ' the maximum for..next value End Sub

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
3/14/2000 8:26:58 PM:Stewart MacFarlane
This is for you Ian
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/15/2000 5:16:55 AM:Stewart MacFarlane
Please vote for this code (if you like 
it that is) , i will post the beta 
version of my quake 2 map installer 
very soon!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/21/2000 10:18:08 PM:Stewart MacFarlane
Thanx to all the people who voted for 
tis code and helped we become one of 
the winners fro the top code of march
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.