daok Posted October 5, 2003 Posted October 5, 2003 I have a splash screen that it's my startup form. Code : Dim frm1 As New frmMain() frm1.Show() me.close() In the frm1 when I click Close button i put: Me.Close() I error... anyone can tell me what should I do to close a form without having error please Quote
daok Posted October 5, 2003 Author Posted October 5, 2003 I have this message: Object reference not set to an instance of an object IF i do : Try EnregistrerNote() Catch e As Exception MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Quote
AlexCode Posted October 5, 2003 Posted October 5, 2003 I think your problems will be gonne if you use the Public Sub Main() ... Quote Software bugs are impossible to detect by anybody except the end user.
daok Posted October 5, 2003 Author Posted October 5, 2003 I really do not see how to use the main and I do not know where to use it. Anyone have an example for me please? Quote
AlexCode Posted October 5, 2003 Posted October 5, 2003 Create a module with the Sub Main in it. See this code: Module mMain Public fSplash As frmSplash Public fMain As frmMain Public Sub Main() fSplash = New frmSplash fSplash.Show() Application.Run(New frmMain) End Sub End Module Now with this you can call the close method of the fSpalsh whenever you want on the fMain code... On the end of the fill of a DataSet for example! :D Quote Software bugs are impossible to detect by anybody except the end user.
*Experts* Volte Posted October 6, 2003 *Experts* Posted October 6, 2003 Here, I just made this: http://www.xtremedotnettalk.com/showthread.php?s=&postid=385716#post385716 I suggest you look at that, as I think it is the best way to create a splash screen. Quote
AlexCode Posted October 6, 2003 Posted October 6, 2003 The VolteFace cade works perfectly but since I discovered this way I have I don't use another. Just because, sometimes, I need to leave the splash screen visible, topmost, with the MainForm already shown. The example I can give you is when the user has to register the product before continuing... Or other example is the leading bunrning software NERO. the splash stays longer than the load of the form...:D Your way is easyer... no doubt :eek: Quote Software bugs are impossible to detect by anybody except the end user.
*Experts* Volte Posted October 6, 2003 *Experts* Posted October 6, 2003 Well, you don't *have* to close the splash screen in the Form_Load event. You can take out the splash.Close() line and it will remain, so then you can close it however else you like. The only reason I would recommend my way is because it allows you to actually initialize the form (which is what splash screens are for), while many of the other ways don't even load the form until the splash screen closes, so no real initializing happens, defeating the point of a splash screen. It's all a matter of preference. :) Quote
AlexCode Posted October 6, 2003 Posted October 6, 2003 Ok... no more struggle... ;) You keep yours, I keep mine... They do quite the same thing !! ehehe :D I like talking with some good coders... Good forum... :D Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.