CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2014

    Exclamation Getting text from TextBox in Windows Form and putting into TextBox in Web Application

    Hello all,

    I am relatively new to programming in general - the last formal object oriented programming class I took was my freshman year of college (my jargon may not be accurate). So please, bear with me. If this question should be asked in a different area (such as the C# forum, please let me know).

    Basically, the premise is this: in one solution I have two projects, a Windows Form Application and a Web Application. My Windows Form Application will be a simple GUI (it will get more complicated later but I wanted to started more simply to start) with a label prompting the user to input some text, a TextBox for the user to input the text, and a Submit button. Once the Submit button is pressed I want to pass whatever was typed into the TextBox to appear in a TextBox on a given webpage (this webpage will be part of a Web Application that already exists but for now I am just using a local host for debugging and getting concepts down).

    I have already designed the form for the Windows Form Application and designed the web page (again simple with a label stating "Text Entered from GUI:" and a TextBox). So now I'm stuck. I've tried a couple of different things and tried searching for a similar problems but no such luck. I thought that I could implement a "using" namespace with the name of my Windows Form project (in the aspx.cs page) but when I run, it doesn't recognize the method I I tried putting the method directly in the .aspx page but it doesn't like the namespace I've given (asked if I was missing an assembly reference...which I am not...).

    I feel like I am making this more difficult than it needs to be and I am not sure where to go from here. If someone needs to look at my code I will post it - I would post it now but it is a bit of a hassle. The computer I am programming on is not allowed to be hooked up to the Internet, nor am I allowed to use devices such as thumb drives, so I will have to type it in by hand. However, I am willing to do this if it means I can get some answers!! Again, I am here to learn and seek advice so any help would be GREATLY appreciated! Also, a speedy response is ideal!

    Oh! I am using Visual Studio 2012, .NET Framework 4.5 and my Windows Form Application is written in C#.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Getting text from TextBox in Windows Form and putting into TextBox in Web Applica

    Web applications aren't really designed to be programmatically driven by outside programs. It can be done via the UI but it isn't all that reliable and other alternatives to posting to the UI are preferred.

    A more preferred way to access the web site is if it exposes any web service or web api interfaces. With this approach, in your windows app, you would write to the webservice (or webapi) method and it would store the data for the web site to access. So, in this approach, you aren't actually writing to the web page per se. In order to do this, the web site has to expose an interface (svc or api) that allows you to write to it. If you are coding the web site, then this isn't really a problem to add to an existing web site.

    On the other hand, if you are connecting to someone else's website, they are going to have to make an interface available.

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