How do I turn off Compatibility View on the IE WebBrowserControl in a WinForms app?

There is no way to do this other than configuring the following registry settings: HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION or if it’s a 32 bit app on 64 bit Windows: HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION` These settings aren’t surfaced in the WebBrowser control. For more information please see: What IE compatibility mode does the webbrowser control use? In case the link … Read more

Show Properties of a Navigation Property in DataGridView (Second Level Properties)

You can use either of these options: Use DataGridViewComboBoxColumn Add corresponding properties to child entity partial class Shape the query to include properties of navigation property using Linq Use CellFormatting event to get value for sub property bounded columns Show string representation of object by overriding ToString() Use a custom TypeDescriptor to enable data binding … Read more

Invoke or BeginInvoke cannot be called on a control until the window handle has been created

It’s possible that you’re creating your controls on the wrong thread. Consider the following documentation from MSDN: This means that InvokeRequired can return false if Invoke is not required (the call occurs on the same thread), or if the control was created on a different thread but the control’s handle has not yet been created. … Read more

Winforms-How can I make MessageBox appear centered on MainForm?

It is possible with some servings of P/Invoke and the magic provided by Control.BeginInvoke(). Add a new class to your project and paste this code: using System; using System.Text; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; class CenterWinDialog : IDisposable { private int mTries = 0; private Form mOwner; public CenterWinDialog(Form owner) { mOwner = owner; … Read more