messagebox problem

Hi,
I find it curious, when soemtimes, i put for example like this :

messagebox.show("")
exit sub

or without exit sub.
after messagebox pop up, and I click on OK. my form always lost focus .
but this things to usually happen on msgbox.
i have to manually click on the form to get the focus again.

is there any other way to get this done, or is the problem of my form settings

Regards
David


Answer this question

messagebox problem

  • SiJP

    Hi,

    I'm not sure this will fix it but have you tried passing in the parent form as a parameter of MessageBox.Show method For example,



    System.Windows.Forms.MessageBox.Show(Me, "Hello world")

     

    Hope this helps,



  • elianaca

    I have seen it happen! are you using VS 2005 beta2



  • Kieran Snyder

    No , i M Still using VS 2003.
    it still happen on vs 2003, especially i got 2 form open , then an error message raise on the other form, would cause lost focus of both.
    but in the mean time i try me.focus, sometimes it works, sometimes not. so, i just try to reduce the error message pop-up.


  • djnilm

    Hi,

    I can not reproduce your problem using the following code:


    Private Sub Button1Click(sender As System.Object, e As System.EventArgs)
    MessageBox.Show("")
    End Sub

     


    but you could try


    me.Focus()
     


    to focus your form after the messagebox dissapears.

  • messagebox problem