Link to home
Create AccountLog in
Avatar of Phill Devey
Phill DeveyFlag for Canada

asked on

Message Box incorrectly popping up even when VB.Net project is not running.

Hello All,

I have a VB.Net project that I needed to add some logging when a message box pops up.

The way I did this was I created a public function called MsgBox. I used this to hijack the old Interaction.MsgBox and pass in some extra variables.  I used these variables to create the event view log entry then return the messagebox as a popup.

I have the code in place, and it works fine. 

However now I am getting some message boxes that are popping up when I open a Winform from the solution controller. 

I do have the project running or even in an active debugging state. I just open the form to for example: look at the designer to move controls around. 

The following message box popups twice:

"The ConnectionString property has not been initialized."

The connection strings we use are in the project's app.config file.

I noticed this error is happening in the project on a form where we have some "base" code for any new forms that get added. 

The forms we build use the "Inherits" to get and run some code off of a base form. This base form executes to get information from a database. This info is in regard to color/button size/width etc. of controls on the forms in the project.

Now I can run the project just fine and no issues are happening on compile and execution. just when opening the winforms in visual studio.

I have noticed if I comment out the msgbox code the popups do not occur, but I will lose my event logging.

If I change the code in base form where is it accessing the database, I can change the error, so I know in some part the issue is there, but I am at a loss as to how to fix that issue or the one with message box.

Thanks in advance for the help and/or any info just let me know.

Avatar of gr8gonzo
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Phill Devey


Thanks for the help gr8gonzo (Great name BTW). It was the constructor issue I had some code that was passing in NULLs for the connection strings as the variables being used were populated in other places in the project outside of the class in question when the exe was run.