How to show a form that needs to be hidden immediately.


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I have a form that I'd like to load, but have it hidden immediately. I'm currently just setting visible to False after it's done loading, but there is flicker. Is there a suggested way to do this.
Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
When I have the need for this, I take a different approach.  First, show the BrowseDialog THEN show the form.  It would look something like this:

Dim myBrw As New MyBrowseDialog()
Dim myBO As New MyBO()
Dim myForm as MyForm

'-- Set the BO to populate (otherwise an error will occur)
myBrw.BusinessObjectToPopulate = myBO

'-- Show the Browse
If myBrw.ShowDialog() = OK Then
    '-- Create and show the form.  Pass over the populated BO and then just do a CopyDataFrom in the Constructor
    '-- of the form.
    myForm = New MyForm(myBO)

    '-- Now show the dialog or show it in your MDI (whatever your need is)
    myForm.ShowDialog()
End If


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Just noticed that I never let y'all know what I actually did. I ended up adding a method to the form to show the browse dialog, then if the dialog returns OK, show the form. Sort of a combo between what I was trying and what Trent suggested:



' In the form that I wanted hidden...

Public Sub Search()

  ' Open search form, test for OK

  Using myBrw As New MyBrowseDialog()

    If myBrw.ShowDialog() = DialogResult.OK Then

      Me.Show()

    Else

      Me.Close

    End If

  End Using

End Sub




And it is called like this

' To run a search...

Dim frm As New MyForm()

frm.Search()

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Greg McGuffey - 17 Years Ago
Edhy Rijo - 17 Years Ago
Greg McGuffey - 17 Years Ago
Edhy Rijo - 17 Years Ago
Greg McGuffey - 17 Years Ago
                         What about something like this: [codesnippet] Public Shared...
Edhy Rijo - 17 Years Ago
                             Nope, that won't work as this is being called in a class that isn't a...
Greg McGuffey - 17 Years Ago
                                 When I have the need for this, I take a different approach. First,...
Trent L. Taylor - 17 Years Ago
                                     Just noticed that I never let y'all know what I actually did. I ended...
Greg McGuffey - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search