Results 1 to 10 of 10

Thread: VB.NET:Simple Question on MessageBox.......[Resolved]

  1. #1

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    VB.NET:Simple Question on MessageBox.......[Resolved]

    Say i have two forms, A and B....

    when i click one button from form A....it will load form B..

    now how to let the messagebox to display on form B after form B is load when i click on form A button...

    instead of displaying the MessageBox first before form B is load when i click on form A button ...

    Thanks
    Last edited by toytoy; Dec 17th, 2004 at 09:38 PM.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474

    Re: VB.NET:Simple Question on MessageBox

    What if showing the messagebox in form B load event?
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Re: VB.NET:Simple Question on MessageBox

    I have already tried...

    but the messagebox will appear before form B is load...

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: VB.NET:Simple Question on MessageBox

    How about a timer control to display the MessageBox?


    BTW, why are you showing the MessageBox on the form loading part?

  5. #5

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Re: VB.NET:Simple Question on MessageBox

    the idea is something like pop up messageboxbox when you open a new form..

    when the user click on form A button ....say the user enter some data in

    form A then it will save these data and display it on form B messagebox to

    tell the user these data is what you key in or other ...etc

    the idea is something there...

  6. #6
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Re: VB.NET:Simple Question on MessageBox

    You should use form B Activated event:

    Code:
        Private Sub formB_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
              if isFirsTime then
                  ' show messagebox
              end if
        End Sub
    regard J

  7. #7
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Re: VB.NET:Simple Question on MessageBox

    Do you want to pass some value from the calling form to the called form or its simply trying to show a message box?

  8. #8

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Re: VB.NET:Simple Question on MessageBox

    Yes..some value is going to pass through..

  9. #9
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Post Re: VB.NET:Simple Question on MessageBox

    in that case you might need to use properties on the called form. something like:
    Code:
     
    dim _CallingForm as form1
    Public Property CallingForm() as form1
    Get
        return _CallingForm
    end get
    Set (ByVal value as Form1)
       _CallingForm = Value
    end set
    end property
    Above code on the called form and on the calling form, something like
    PHP Code:
    Callingform.textbox.text textbox1.text 

  10. #10

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Re: VB.NET:Simple Question on MessageBox

    I do it in a odd way....

    but still can works...

    Hope have any better way than this....

    Code:
    'In Form 1'
    Private Sub btnGoToForm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesbtnGoToForm2.Click
        Dim a As New Form2
        a.Show()
        MessageBox.Show("Open Form 2")
        a.Activate()    ' probably not really needed, depends on your layout
        Me.Hide()
    End Sub
    
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' no MessageBox here
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width