Looking through my project for some clues as to what might be happening. This project is a Windows Forms Application. It does not have any forms (including a startup form), it uses the Main sub-routine in the modMain module as the startup object. To do this, I had to un-check the “Use Entity Framework” checkbox for the Project.
If I add a form to the project, check the “Use Entity Framework” checkbox for the Project, and set the form to be the startup object, then the MessageBox layout is correct (no overlap of the icon and the text). Just like the one in Tyson’s reply (see post #2 above).
If i create a new Console Application, set a reference to System.Windows.Forms, import the modMain from my original application, and make modMain the startup object, then the MessageBox layouts have the problem as shown in my initial post above.
Why does the MessageBox appear differently in a Console Application vs. a Windows Forms Application?
Last edited by Mark@SF; Jan 23rd, 2019 at 11:13 PM.
There is no Application Framework (not Entity Framework) in C# so, when you create a WinForms app project in C#, it generates a Main method for you and it looks like this:
You need to make those two initial method calls in your own Main method in VB if you use one. Presumably you are not calling Application.SetCompatibleTextRenderingDefault and that's causing this issue.
By the way, if you're not using a startup form then are you still calling Application.Run and passing a custom ApplicationContext? If not, you should be. To learn how, check out the thread below.:
Thanks for the follow-up. My bad re: the framework (I was working off-line on my iPad last night and relying on my memory instead of the actual VB Studio screen!). It is indeed the "Enable application framework" checkbox.
Your suggestion to set the Application's EnableVisualStyles property solved my MessageBox layout issue. The SetCompatibleTextRenderingDefault property didn’t make any difference wrt the MessageBox problem (My Googling on it indicates this property is for back-capability with Net 1.x which doesn’t really apply to my situation). Since I don't have any forms in my project, I didn't include the "Application.Run(new Form1())" statement that you suggested.
Thanks again for your help. Every time I come to this forum with a question I always am amazed at the willingness of the members to help and its much appreciated! There's a lot I need to learn and this is a great place for that.
Last edited by Mark@SF; Jan 24th, 2019 at 02:25 PM.
Since I don't have any forms in my project, I didn't include the "Application.Run(new Form1())" statement that you suggested.
Not having any forms is not a reason not to call Application.Run. As I said, you should still be making that call and passing an ApplicationContext instead of a form. The link I provided demonstrates how to do that.