Results 1 to 13 of 13

Thread: open form modally [resolved!]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870

    open form modally [resolved!]

    Hi,

    how do i open a form so the code does not continue on the parent form until the form closes. I think it used to be vbmodal or something in VB6 but can't work it out in vb.net

    many thanks
    Nick
    Last edited by nswan; May 26th, 2003 at 04:46 PM.
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    Dim frm As New frmAddProduct()
    frm.ShowDialog()

    works!
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    damm that doesn't run the form_load routine then on the form you are opening. Any ideas?
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    How comes ???
    Everything should run, unless you are trying to close the modal form on load event, which can not be achived that way in Framework 1.0
    '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

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    i have this code on one form
    Code:
    Dim frm As New frmAddProduct()
    frm.ShowDialog()
    but it doesn't run
    Code:
    Private Sub frmAddProduct_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    But you didnt clarify how you say it doesnt run?
    '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

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    it doesn't execute the code in that sub routine. I put a break point on it and it doesn't stop.
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  8. #8
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Thats weird, I dont have a problem here. If your form is shown then for sure it runs form_load event.
    I think i dont need to say that when u put a break point u have to press F11, not F5 to stop on it.
    '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

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    well i put a message box in the form_load code anyways and it doesn't open that
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  10. #10
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    will u send me the problematic part of project to test it?
    '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

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    ok i'll email it to you.
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    well i found a work around.
    I called the form_load event thing on the form i was opening sLoad and made it public. I then called sLoad before frm.showdialog.

    it's works but doesn't explain why it didn't before
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  13. #13
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Ok, I found where the problem lies, but have no idea why it happens.
    Comment these two lines in the Wizard Generated Code. You can find the near the end of that piece of code.
    CType(Me.imcProductID, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.imcProductName, System.ComponentModel.ISupportInitialize).EndInit()
    '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

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