Featured post
winforms - Is there any way to display a Windows form BEFORE the "Startup" form is loaded in VB.NET? -
my company's main software package includes hefty configuration library loads on startup. config library includes mandatory settings which, if not supplied (via command line arguments), cause entire application exit.
this has never been issue our users, launch software via scripts have needed command line arguments supplied automatically. when debugging our software developers forget specify necessary arguments in visual studio's debug options; it's annoying greeted message config specification invalid -- missing required parameters x, y, , z -- shutting down (i'm paraphrasing, of course).
it's not big deal, annoyance. still, felt worthwhile throw little form make process little less painful; notifies user parameters missing , allows him/her specify values parameters directly on form, without having restart application.
my intentions (i think?), seems can't solution work. problem after i've launched our software missing settings, form pops , prompts me expected; after i've entered required parameters , it's time application "really" start, invalidoperationexception
:
setcompatibletextrenderingdefault must called before first iwin32window object created in application.
i think understand what's going on here: vb.net project i'm working on doing "behind scenes"*:
sub main() application.enablevisualstyles() application.setcompatibletextrenderingdefault(false) application.run(new mainform) end sub
that call setcompatibletextrenderingdefault
is, apparently, throwing exception because form created , displayed prior execution.
is there way around this? there perhaps more "proper" solution problem i'm not thinking of (i.e., should not trying collect user input via form @ all)?
*this best guess based on i've seen in c# winforms projects. strangely, unless i'm missing something, seems vb.net winforms projects hide developer.
do make sure have application framework option turned off , sub main selected starting method. make similar this:
sub main(byval args() string) application.enablevisualstyles() application.setcompatibletextrenderingdefault(false) if args.length = 0 using dlg new optionsdialog if dlg.showdialog <> dialogresult.ok return '' use dlg result... end using end if application.run(new mainform) end sub
- Get link
- X
- Other Apps
Comments
Post a Comment