|
-
Dec 27th, 2010, 01:34 PM
#1
Thread Starter
Lively Member
Converting Windows Form Application in web application
Hi everyone,
Is it possible to convert a windows form application into a web application?
If it is not possible, how can I add the OpenFileDialog in a web application form?
I cannot see it in the toolbox if i choose new web application. On the other hand, I can see it if I choose windows form application.
Thank you,
A.
-
Dec 27th, 2010, 01:43 PM
#2
Re: Converting Windows Form Application in web application
That would make sense... the IDE only shows you controls that are valid for the project type.
To get what you want, you need to add an Input control with a type of "file" ... I think... don't do much web development, but I think that's right. Best bet would be to get this moved to the ASP.NET forums, you'll get a more precise answer there. (I'll take care of the move request).
-tg
-
Dec 27th, 2010, 01:44 PM
#3
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
aaalll right!
thanks a lot.
A.
-
Dec 27th, 2010, 01:58 PM
#4
Re: Converting Windows Form Application in web application
Thread moved to 'ASP.Net' forum (thanks as always for letting us know tg )
-
Dec 27th, 2010, 02:01 PM
#5
Re: Converting Windows Form Application in web application
Hey,
There are some pretty big differences between the Windows Application and Web Application worlds, so things that are possible, and make sense in the Windows world, don't always make sense in the Web world.
What exactly are you using the OpenFileDialog for in the application? Bear in mind that any file that you open will be on the client's computer, and if you need to use it in your application will have to be uploaded onto the server for processing.
Gary
-
Dec 27th, 2010, 02:03 PM
#6
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
I just added a "FileUpload1" from the toolbox.
Now, Since before I had in the code something like
(TextBox1.Text)
Since I removed the text box and put a "fileupload", how can i substitute the textbox1.text with fileupload1? I tried by typing fileupload1.text but it is not correct!
Please help
A.
-
Dec 27th, 2010, 02:09 PM
#7
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
Hi Gep,
I need an opendialogbox to upload a .doc file which will be merged with an other .doc file (which will be always the same file, so there is no need to select this file) and then the merged file will be converted into a pdf file.
The windows application I wrote works fine! Now I am trying to uploading it on my website.
Thank you,
A.
-
Dec 27th, 2010, 02:20 PM
#8
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
So I just found out that the app I wrote works fine also as a web app!
The only thing that I do not know how to do is inserting a openfiledialog box!
I inserted a textbox and if I write the directory of the file that I wish to open the program works fine!
Regards,
A.
-
Dec 27th, 2010, 02:21 PM
#9
Re: Converting Windows Form Application in web application
Hey,
You might want to take a look at the following walkthrough:
http://msdn.microsoft.com/en-us/library/aa479405.aspx
As I mentioned, the main portion of the code that you have in your windows application, i.e. the merging of the files, and the converting to PDF will port more of less directly into your Web Application, however, you will have some "different" work to do, to actually get the files onto the server.
Gary
-
Dec 27th, 2010, 09:37 PM
#10
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
thanks for the help gep13.
I am almost done with my program.
I created a textbox where I manually write the directory of the .doc file which I want to convert into .PDF.
For example I write in the textbox C:\filetoconvert.doc and then I hit the convert button. The program works fine!
Now... I do not want to type every time the directory where the file is, but I would like to implement a "browse file" option so I can browse the folders on my pc and select the file I wish to convert.
How can I do that?
I tried with the "fileupload" and with the "Input (file)" but I cannot get them to work!
Thank you,
A.
-
Dec 29th, 2010, 06:10 AM
#11
Re: Converting Windows Form Application in web application
 Originally Posted by Netmaster
Now... I do not want to type every time the directory where the file is, but I would like to implement a "browse file" option so I can browse the folders on my pc and select the file I wish to convert.
I believe that what you are trying to do is specifically forbidden due to the fact that web pages could simply start stealing files off client machines if the web page could "change" the name of the file to upload.
kleinma explains it well in this thread
http://www.vbforums.com/showthread.p...ghlight=upload
-
Dec 29th, 2010, 08:35 AM
#12
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
szlammy,
The program I created just converts documents into pdf files. Here is how it works:
By clicking on the browse option you select a .doc or a .docx or a .txt file from your computer. Then you hit the convert button and the program makes a copy of the file you selected and converts this copy of the file in .pdf.
There are thousands of websites which have this function.
-
Dec 29th, 2010, 08:40 AM
#13
Re: Converting Windows Form Application in web application
I thought you were asking for how to have a default appear in the upload textbox.
Am I mistaken?
-
Dec 29th, 2010, 08:51 AM
#14
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
Oh I got it.
What I am looking for is putting a button that allows you to browse files on your computer. So you do not need to type manually the directory of the file. For example: C:\Documents\document.doc.
The function I am looking for is called "openfiledialog" but such thing is not available for web applications! 
Thank you,
A.
-
Dec 29th, 2010, 09:01 AM
#15
Re: Converting Windows Form Application in web application
Yes there is... http://www.w3schools.com/TAGS/tag_input.asp
I even pointed this out in post #2...
To get what you want, you need to add an Input control with a type of "file"
I'm not sure how it gets any simpler...
-tg
-
Dec 29th, 2010, 09:05 AM
#16
Re: Converting Windows Form Application in web application
@tg - If I'm not mistaken the UPLOAD filename can only come from the upload controls internal textbox.
-
Dec 29th, 2010, 09:16 AM
#17
Re: Converting Windows Form Application in web application
Okay.... what's wrong with that? He changes his input from a text to a file type.... would that not allow for browsing to a file? When Submit is then clicked, the file would get uploaded to the server, where the code would then take over and do what it needs to do with it.
-tg
-
Dec 29th, 2010, 09:19 AM
#18
Re: Converting Windows Form Application in web application
If I'm not mistaken he wants to pre-populate the "textbox" with a filename or file path - that cannot be done from the server while rendering the page.
-
Dec 29th, 2010, 10:15 AM
#19
Re: Converting Windows Form Application in web application
This is what he's looking for:
What I am looking for is putting a button that allows you to browse files on your computer.
You can't pre-populate a file upload textbox, and for good reason (imagine if you could, and then set it to hidden... you could upload files w/o the user's consent/knowledge).
-tg
-
Dec 29th, 2010, 10:32 AM
#20
Thread Starter
Lively Member
Re: Converting Windows Form Application in web application
techgnome that is an html code. I need the vb code. does this forum allow you to post external link? so I can show you what I am talking about...
-
Dec 29th, 2010, 01:43 PM
#21
Re: Converting Windows Form Application in web application
Yes, if there is a link to a site that will show what you are trying to explain, then feel free.
Bottom line is, if you are trying to access files on the client machine, then this work has to be done on the client side, i.e. using an HTML input control. You can't access files on the client file system directly from your server side code, the file first has to be chosen on the client, uploaded to the server, and then worked on.
Gary
-
Dec 29th, 2010, 01:53 PM
#22
Re: Converting Windows Form Application in web application
 Originally Posted by gep13
... the file first has to be chosen on the client, uploaded to the server, and then worked on.
Gary
That's what I've been trying to say! You even lose the filename in a postback - which was I believe the issue I was having in the other thread I linked to.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|