473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Drag and drop parameter

Howdy,

I havn't been using VB.NET just a whole lot, and am finally making the
transistion from VB6 to dotnet. (Yeah it is pretty sad, I know.)

Anyhow, I have created several apps in vb6 that I allowed the user to drag
and drop a file onto the executable. The executable would grab the path and
filename of the dropped file and store it in a variable. I could then use
the variable to access and manipulate the file.
I also used the same thing to use execution parameters for the executables.
I simply declared a variable, then in the form load routine I set the
variable = to the command

something along the lines of this
Dim DXF_File
Private Sub Form_Load()

DXFFile = Command

If the user dropped the file "C:\howdy.txt" onto the executable then the
value of the variable DXFFile would be "C:\howdy.txt"

How the hell do I do that in VB.Net? I have looked in the documentation and
couldn't figure out what the heck to look for.

If you could offer some direction I would appreciate it.

Thanks,

John
Jun 17 '07 #1
3 1972
In Form.Load, you can use the Shared variable Environment.CommandLine
to access the exe name in double quotes followed by a space and then
the dropped file path.

If Environment.CommandLine.Length 0 Then
Dim i As Integer = Environment.CommandLine.IndexOf(""" ")
If i - 1 Then
Dim pathName As String = Environment.CommandLine.Substring((i +
2))
MessageBox.Show(pathName)
End If
End If

====================
Clay Burch
Syncfusion, Inc.
Jun 17 '07 #2
John,

Try this, add this for the command equiv from vb6:
'save command line arguments passed to the application
For Each s As String In My.Application.CommandLineArgs
StartupCommand = s.ToLower
Exit For
Next
StartupCommand is now sort of the same as command from vb6 and has the file
name.

My.Application.CommandLineArgs has the info and its not the same as vb6.

Tom
"John" wrote:
Howdy,

I havn't been using VB.NET just a whole lot, and am finally making the
transistion from VB6 to dotnet. (Yeah it is pretty sad, I know.)

Anyhow, I have created several apps in vb6 that I allowed the user to drag
and drop a file onto the executable. The executable would grab the path and
filename of the dropped file and store it in a variable. I could then use
the variable to access and manipulate the file.
I also used the same thing to use execution parameters for the executables.
I simply declared a variable, then in the form load routine I set the
variable = to the command

something along the lines of this
Dim DXF_File
Private Sub Form_Load()

DXFFile = Command

If the user dropped the file "C:\howdy.txt" onto the executable then the
value of the variable DXFFile would be "C:\howdy.txt"

How the hell do I do that in VB.Net? I have looked in the documentation and
couldn't figure out what the heck to look for.

If you could offer some direction I would appreciate it.

Thanks,

John
Jun 18 '07 #3
I ended up going with this one. Worked like a charm.

Thanks for the input, I was getting frustrated.
"ClayB" <cl***@syncfusion.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
In Form.Load, you can use the Shared variable Environment.CommandLine
to access the exe name in double quotes followed by a space and then
the dropped file path.

If Environment.CommandLine.Length 0 Then
Dim i As Integer = Environment.CommandLine.IndexOf(""" ")
If i - 1 Then
Dim pathName As String = Environment.CommandLine.Substring((i +
2))
MessageBox.Show(pathName)
End If
End If

====================
Clay Burch
Syncfusion, Inc.


Jun 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patrick Kramer | last post by:
I'm building a file format converter for someone who at best takes more than his fair share of IT helpdesk hours :D So I want to make it as simple as possible. What I want it to do is, run: ...
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
8
by: Paul | last post by:
I have looked and looked for this info. All the I/O examples I've found either explicity use a file name or use the OpenFileDialog. When you drag a MS Word document over MS Word, it launches and...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
9
by: Mark | last post by:
hi... i have a program that opens a couple files and performs some operations on them. i wanted to modify my program so that if you drag and drop a file onto the exe via windows, it will open...
0
by: RHSFSS | last post by:
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution? I have a .NET 2.0 ...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.