Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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 use...so 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#.
Posted
Comments
[no name] 28-Aug-14 16:18pm    
You could probably make use of the WebClient class to pass data from your winform to your web form. I highly doubt that you will have any success just trying to "use" one within the other like you describe. The concepts of winform and web programming a vastly different.
Sergey Alexandrovich Kryukov 28-Aug-14 17:28pm    
Doubt? It would not make any sense at all, by pretty apparent reason. I tried to describe what to do in Solution 1.
My doubt is different: I doubt that OP is ready to do any development yet, needs some education, at least on the basics...
—SA

1 solution

The question clearly shows that you have no idea what you are trying to do, and have little idea of .NET programming. For example, you don't understand referencing, and, more generally, using assemblies and probably think that using directive somehow helps to use the assembly (it does not, it merely changes the naming rules for assembly-level types, allows to shorten the names in their use). So, with such level of understanding, doing any Web even just UI development would be premature. First, you need to learn the basics of programming, which is much easier to do with simple console-only application. Anyway, using System.Windows.Forms in ASP.NET application makes no sense at all, because all .NET code works on the server side; by the same reason, there is absolutely no sense in using most ASP.NET classes in any "desktop" applications.

At the same time, the problem is relatively easy. On the client side, you just need to send some HTTP request with appropriate data with some URL: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx[^].

On server side, you should have some ASP.NET application at this URL. The application should take the data from HTTP request and, depending on the data, produce certain HTML content. This is how the HTTP request is represented on the server side: http://msdn.microsoft.com/en-us/library/system.web.httprequest%28v=vs.110%29.aspx[^].

Some examples of the usage are shown at the end of the MSDN page referenced above.

—SA
 
Share this answer
 
v2
Comments
nolski13 28-Aug-14 20:11pm    
I appreciate all the "kind" help and guidance. I am clearly struggling so yes, I would say that I'm not positive where to go. I am merely going off of what I was instructed to accomplish and I can see that we need to rethink how we are going to get what we want.
Sergey Alexandrovich Kryukov 28-Aug-14 23:38pm    
You are welcome. And your follow-up questions will be welcome; which are never too late to ask, even on this page.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900