[Solved] Opening and writing to form from console aplication [closed]


If you want to open the form with a console application, you can refer to the following steps:

First add this code in .csproj file of the console application:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0-windows</TargetFramework>
        <UseWindowsForms>true</UseWindowsForms>  
    </PropertyGroup>
</Project>

Second add project reference of GUI VISUIALZATION:
enter image description here

Finally you can refer to the following code in console application:

class Program
{
    static void Main(string[] args)
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new GUI());
        Console.ReadKey();
    }
}

Here is the test result:
enter image description here

2

solved Opening and writing to form from console aplication [closed]