0

I have one solution and 2 project on visual studio c#. First project is a windows form project 1 Form and 1 button on it. Second project is a asp.net mvc project. Index.cshtm has a submit type button.

When I click submit button, I want to send parameters to other project(windows form project) and execute a method(this method on form project) like button1_click

How can I do it?

[SOLUTION]

using window.external.function

What is the use of window.external?

Bunyamin Aslan
  • 193
  • 1
  • 11
  • You can achieve this by adding a reference to the Winforms project in your MVC project, but if it's the exact same functionality, I would reccommend that you separate the method to a class library that can be referenced by both projects. – Lars Kristensen Apr 26 '18 at 10:50
  • you could look into Microsoft's ClickOnce: essentially you provide a packaged version of your winforms exe on the same webserver that hosts your MVC application and then the user can start the exe from a link. It is possible to pass parameters, but it is not seamless. – Cee McSharpface Apr 26 '18 at 10:50
  • @lars that would run server-side. OP wants to run that from the client browser (ASP.NET MVC) – Cee McSharpface Apr 26 '18 at 10:52
  • some related stuff [here](https://stackoverflow.com/questions/39444551/how-to-open-exe-file-on-client-system-in-a-web-application) and [here](https://stackoverflow.com/questions/1791511/run-exe-from-client-side) – Cee McSharpface Apr 26 '18 at 10:54
  • @dlatikay OP's question can be interpreted both as wanting to run the same functionality through a web project, and as wanting to actually perform a click on a button in a winforms app through an MVC app. Without clarification, we don't know exactly what OP wants to achieve. – Lars Kristensen Apr 26 '18 at 11:01
  • Looks like you need to send click event to some application. Check this - https://stackoverflow.com/questions/4899573/click-on-a-button-in-another-application-from-my-c-sharp-application – Alex Veremeenko Apr 26 '18 at 11:28

1 Answers1

0

Here is a similar question that have been answered

The easiest solution is using a database.

Create remote database which both web application and windows application can communicate Use timer object to frequently query the database and display new messages are required Complex solution involves creating UDP/TCP connections between applications.

Sample

Mike
  • 850
  • 10
  • 33