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:
 
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 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 ...
    • Convert your Microsoft Access application to a Web Application

      Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. It is a member of the Microsoft Office suite of ...
    • Thinfinity VirtualUI: Publishing an Application

      Product: Thinfinity VirtualUI Version: 3 and above Introduction Thinfinity VirtualUI is a software solution designed to facilitate web integration for Windows-based applications. This guide will walk you through the process of getting started with ...