How to Run a WinForms Application Inside the Web Browser

How to Run a WinForms Application Inside the Web Browser

Do you have a WinForms (C#) application that you wish to publish on the web? Thinfinity® VirtualUI allows you to convert WinForms to web application by adding a small line of code to your C# application so it can then be accessed from any OS and device via an HTML-able browser.

Before starting please make sure you are running the latest Thinfinity VirtualUI version and download our C# demo:

https://www.cybelesoft.com/support/files/DemosVUI/cSharpDemo.zip

Now you can follow these steps to integrate a .NET WinForms (C#) application with Thinfinity VirtualUI:
1. Open Microsoft Visual Studio
2. Open the .sln project of the provided demos:
 
 
3. Right-click on the project name in the ‘Solution Explorer’ panel and then select ‘Add’ > ‘Existing Item’. Look for the Thinfinity.VirtualUI.cs file, which is typically located in C:\Program Files\Thinfinity\VirtualUI\Dev\dotNet\
 

 
4. In the program.cs file, add the following line:
 
Info
using System;
using System.Windows.Forms;
namespace MyApp
{
      static class Program
      {      
      ///<summary>
      ///The main entry point for the aplication.
      ///</summary>
      [STAThread]
      static void Main()
            {
            new Cybele.Thinfinity.VirtualUI().Start();
            Application.EnableVisualStyles();
            Application.setCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            }
      } 
}     

5. Compile your program and run it in debug mode.
Once the debug is finished you will see this message popup:
 

 
If you press the ‘Start Web Browser’ button, a web browser will open pointing to the application. The application will also open in desktop mode.
6. Alternatively, you are able to choose “Do not show again” and manually launch the application on the web by going to the “Thinfinity VirtualUI Development Server” systray icon:
 

 
This systray icon shows up whenever you debug an application with your IDE. You can right-click on the icon and then click on the ‘Open Web Browser’.
A Web browser window will open and your application will be running inside.

 

When you run your application under an IDE, it automatically starts in web mode. In order to access the application, open your web browser and point to http://127.0.0.1:6080
 
8. You can also click on the ‘Server Manager‘ menu of the tray bar icon to access the Development Server Manager.

    • Related Articles

    • How to Run a .NET Application in a Web Browser

      Overview Note Pre-requisites: To proceed with this tutorial, you may need to register a trial license for the VirtualUI Development Server, Learn how to do it in this article. Now you are ready to get started. Let’s take your program to the cloud! ...
    • How to Run an OpenEdge Application Inside the Web Browser

      Client-server applications are expensive and tough to maintain. Working on an entirely new web application alternative becomes unfeasible if your time is limited or your resources are scarce. Save time and money by webifying your application with ...
    • Run VB.Net Software as a Web Application

      In this new article, we will show you how to adapt your Visual FoxPro code so you can run VB.Net developments in the cloud with Thinfinity VirtualUI. App example: https://www.cybelesoft.com/support/files/DemosVUI/VBNet.zip Bear in mind in this ...
    • How to Publish an Application in Thinfinity VirtualUI Server

      Product: Thinfinity VirtualUI Version: 3 and above Introduction This step-by-step tutorial will guide you through the process of virtualizing your applications and making them accessible from any web browser using Thinfinity VirtualUI. Get ready to ...
    • How to Run a Python Development as Web App

      Have a Python application and want to run it on the web? Thinfinity® VirtualUI is a windows software virtualization solution. By adding a piece of code to your Python app source you can then run it within a web browser and access it from any OS. Run ...