During installtion of a windows application, if we have to show a custom message box, then the custom message box always comes behind the installtaion wizard form. To handle this issue one can create a form with topmost property set to true and open the message box having this form as owner.
Following is the code sample that will create a messagbox class.
[VB.NET CODE TO CREATE CLASS]
Public Class clsTopMostMessageBox
Public Shared Function Show(ByVal title As String, ByVal message As String, ByVal buttons As MessageBoxButtons, ByVal icons As MessageBoxIcon) As DialogResult
' Create a host form that is a TopMost window which will be the
' parent of the MessageBox.
Dim topmostForm As Form = New Form()
' new form should not be visible so position it off the visible screen and make it as small as possible
topmostForm.Size = New System.Drawing.Size(1, 1)
topmostForm.StartPosition = FormStartPosition.Manual
Dim rect As System.Drawing.Rectangle = SystemInformation.VirtualScreen
topmostForm.Location = New System.Drawing.Point(rect.Bottom + 10, rect.Right + 10)
' Make this form the active form and make it TopMost
topmostForm.TopMost = True
' Finally show the MessageBox with the form just created as its owner
Dim result As DialogResult = MessageBox.Show(topmostForm, message, title, buttons, icons)
'clean it up all the way
[VB.NET CLASS ENDS]
[VB.NET CODE TO CALL THE MESAGE BOX]
Now the messagebox will appear above the installation wizard.