Results 1 to 22 of 22

Thread: Converting Windows Form Application in web application

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    Re: Converting Windows Form Application in web application

    aaalll right!
    thanks a lot.
    A.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Converting Windows Form Application in web application

    Thread moved to 'ASP.Net' forum (thanks as always for letting us know tg )

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  11. #11
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Converting Windows Form Application in web application

    Quote Originally Posted by Netmaster View Post
    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

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  13. #13
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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.

  15. #15
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  17. #17
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  18. #18
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  19. #19
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  20. #20

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    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...

  21. #21
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  22. #22
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Converting Windows Form Application in web application

    Quote Originally Posted by gep13 View Post
    ... 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.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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
  •  



Click Here to Expand Forum to Full Width