473,387 Members | 1,790 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,387 software developers and data experts.

Dropping files onto c# prog

I am writing a c# app and need the ability to drag a file onto the icon - this should then run the app and do something with the file.

I made the assumption that doing so would call the app with the filename as a command line argument, but this seems to go a bit weird. I added this to my Main:
Expand|Select|Wrap|Line Numbers
  1. static void Main(string [] args) {
  2.   if(args != null && args.Length > 0) {
  3.     // Do Something here.
  4.   }
  5.   else {
  6.     // Do something else here.
  7.   }
  8.   Application.Run(new Form1());
  9. }
It didn't work. I also made a teeny test app which had basically JUST the above in it, but I also added a StreamWrite to dump the contents of args out to a file. The strange part is that if I dragged a file onto the prog icon, it completely skipped the whole section to do with args.

The worst part is that because dropping onto the icon is how i need the app to start, I can't use vs.net to debug it! :(

Help please? :D
Sep 11 '05 #1
0 1596

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
5
by: joe | last post by:
I have an image database that I'd like to populate by dragging an image off the desktop and dropping onto a form (cut/paste would work equally as well) Any suggestions? Thanks, Joe
6
by: Ashok | last post by:
hi, i want to know how to make a specific type of file open in an application i developed in python when the user clicks on the file.(in windows) for eg. a .txt file when clicked opens in notepad,...
1
by: Greg | last post by:
I have a custom control called PageBanner which is compiled into a DLL and then put into the toolbox. It shows like I would expect it to in the toolbox, and I can drag and drop it onto a form. ...
2
by: Christian Blackburn | last post by:
Hi Gang, I would like to be able to drag and drop documents onto my application and have them open immediately thereafter. Can somebody point me towards a KB article or example? I could find a...
5
by: al jones | last post by:
Normally I have some idea of where in the MSDN to start looking but on this one I have absolutely no idea. A fellow who uses my 'toy' asked if would be possible to drop a folder of files /...
2
by: kellog | last post by:
Hi there, I really have no idea which forum this belongs in, as it pertains to software, but databases and graphics all at once. Pardon my ignorance toward programming, I am more of a graphics...
3
by: daniel.haude | last post by:
Hello people, I'd like to have the functionality known from "real" executables that if I drag-drop a file icon on top of the app, the app starts and has the file's path as command-line argument....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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...

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.