473,790 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.t xt" onto the executable then the
value of the variable DXFFile would be "C:\howdy.t xt"

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 1983
In Form.Load, you can use the Shared variable Environment.Com mandLine
to access the exe name in double quotes followed by a space and then
the dropped file path.

If Environment.Com mandLine.Length 0 Then
Dim i As Integer = Environment.Com mandLine.IndexO f(""" ")
If i - 1 Then
Dim pathName As String = Environment.Com mandLine.Substr ing((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.t xt" onto the executable then the
value of the variable DXFFile would be "C:\howdy.t xt"

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***@syncfusi on.comwrote in message
news:11******** **************@ c77g2000hse.goo glegroups.com.. .
In Form.Load, you can use the Shared variable Environment.Com mandLine
to access the exe name in double quotes followed by a space and then
the dropped file path.

If Environment.Com mandLine.Length 0 Then
Dim i As Integer = Environment.Com mandLine.IndexO f(""" ")
If i - 1 Then
Dim pathName As String = Environment.Com mandLine.Substr ing((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
2591
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: program.exe file.txt When I drop file.txt onto the executable file. In other words, take whatever file dropped onto the executable as the second CLI arugment.
0
2605
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 simutate it. Can anyone help? Thanks ************************** previous post: Message 1 in thread
2
4337
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 there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10420
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== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
6
3562
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 where the user can run on firefox/mozilla, what would be a good approach. 1. Should I overwrite the javascript code drag-and-drop to make it more browser independent. If I want to go this route, can anybody provide me a
8
3671
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 opens the document. I would like my App to launch and open a document (if it has the correct extension). What is the launch event sequence and where do I pick up the path/name of the file or files that were dropped on the application icon? Any...
3
10600
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
9
3562
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 this file and use it instead. however, without even modifying my code first, if i drag and drop a file onto the exe it no longer opens/writes to the files specified by the program. but when no file is dragged onto it, it runs fine as
0
2499
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 application (actually in C#) called from a third party piece of software via VBScript. The VB script passes an object as a parameter which my application applies changes to. My C# application dynamically creates a form, which includes controls...
5
13812
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 drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.