I changed the startup form but not applied in visual studio 2022

Hossameldin Elagamy 45 Reputation points
2023-02-03T07:11:56.92+00:00

Hi, I changed the startup form but not applied in visual studio 2022, also any other changes I make doesn't take place although there is no errors in the error list, please help

Developer technologies | .NET | Other
Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
    2023-02-14T03:12:03.52+00:00

    Hi Hossam,

    If you try to create a new Winform project => right-click the project name => Add => New Item… => select C# Items - Form (Windows Forms) => change it’s name to Form2.cs => click Add => drag one control to this new form for example a button => double click to open Program.cs file => modify the code line from Application.Run(new Form1()); to Application.Run(new Form2()); and then click to run the project, will the form2 show as the startup form?

    If the form2 shows as the startup form, may I ask if you accept this method to change the startup form(change the code)? If you accept this method and do the same thing for your project, then will it work for your project(if it doesn’t work, please share us a minimal reproducible sample to check further, perhaps the issue is hidden in your specific project)? If you don’t accept this method, may I know if you have any concerns?

    If the form2 doesn’t show(not applied), then please try following:

    1. Repair Visual Studio from VS Installer => More => Repair.
    2. Reset Visual Studio settings by following this document: Reset all settings.
    3. If you are using any extensions, please try to disable them temporarily and test again.
    4. If it is acceptable, please try to uninstall and reinstall Visual Studio.
    5. If all of the above don’t work, please open VS => click Help => Send Feedback => Report a Problem…

    Feel free to let us know the result.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.