Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3599466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:22:17+00:00 2026-05-18T20:22:17+00:00

My company’s main software package includes a hefty configuration library which loads on startup.

  • 0

My company’s main software package includes a hefty configuration library which loads on startup. This config library includes some mandatory settings which, if not supplied (via command line arguments), cause the entire application to exit.

This has never been an issue for our users, who launch the software via scripts which have the needed command line arguments supplied automatically. But sometimes when debugging our software we developers forget to specify the necessary arguments in Visual Studio’s debug options; it’s then very annoying to be greeted with the message Config specification invalid — missing required parameters X, Y, and Z — shutting down (I’m paraphrasing, of course).

It’s not really a big deal, just an annoyance. Still, I felt it worthwhile to throw together a little form to make this process a little less painful; it notifies the user which parameters are missing and allows him/her to specify values for those parameters directly on the form, without having to restart the application.

My intentions were good (I think?), but it seems I can’t get this solution to actually work. The problem is that after I’ve launched our software with missing settings, the form pops up and prompts me as expected; but after I’ve entered the required parameters and it’s time for the application to “really” start, I get this InvalidOperationException:

SetCompatibleTextRenderingDefault must
be called before the first
IWin32Window object is created in the
application.

I think I understand what’s going on here: the VB.NET project I’m working on is doing something like this “behind the scenes”*:

Sub Main()
    Application.EnableVisualStyles()
    Application.SetCompatibleTextRenderingDefault(False)
    Application.Run(New MainForm)
End Sub

That call to SetCompatibleTextRenderingDefault is, apparently, throwing an exception because a form was already created and displayed prior to its execution.

Is there any way around this? Is there perhaps a more “proper” solution to this problem that I’m not thinking of (i.e., should I not be trying to collect user input via a form at all)?

*This is a best guess based on what I’ve seen in C# WinForms projects. Strangely, unless I’m missing something, it seems that VB.NET WinForms projects completely hide this from the developer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:22:17+00:00Added an answer on May 18, 2026 at 8:22 pm

    Do make sure that you have the application framework option turned off and Sub Main selected as the starting method. Make it look similar to this:

    Sub Main(ByVal args() As String)
        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        If args.Length = 0 Then
            Using dlg As New OptionsDialog
                If dlg.ShowDialog <> DialogResult.OK Then Return
                '' Use dlg result...
            End Using
        End If
        Application.Run(New MainForm)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Company 1 has this vector: ['books','video','photography','food','toothpaste','burgers'] ... ... Company 2 has this vector: ['video','processor','photography','LCD','power
The company for which I work for has built a large ASP.NET MVC application
A company I work for develops winforms .net applications in which users are required
our company is trying to increase software quality by enforcing minimum function coverage on
My company is using CVS as our de-facto standard for source control. However, I've
My company has developed a long standing product using MFC in Visual C++ as
Our company is currently writing a GUI automation testing tool for compact framework applications.
The company I used to work with has two developers working fulltime, and a
The company I work for makes hardware that communicates to the computer though a
The company I work for is wanting to add blog functionality to our website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.