mike55 Posted November 22, 2004 Posted November 22, 2004 Hi all Have a windows form that i can minimise but have set the maximies propertie to false. Am using a Context menu to reshow the window but keep crashing the programme when I select that option. Can anyone tell me what is the command to show up the window? Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Administrators PlausiblyDamp Posted November 22, 2004 Administrators Posted November 22, 2004 Could you post the code you are using? You should be able to redisplay the form either by doing .Show or by setting .WindowState= FormWindowState.Normal Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mike55 Posted November 23, 2004 Author Posted November 23, 2004 (edited) Could you post the code you are using? You should be able to redisplay the form either by doing .Show or by setting .WindowState= FormWindowState.Normal Ok have tried a number of different thinks but they all give the same result, the following error: An unhandled exception of type 'System.NullReferenceException' occurred in FileWatch.exe Additional information: Object reference not set to an instance of an object. Here is the code i have tried frmWatch.ActiveForm.visible = true frmWatch.ActiveForm.Show() frmWatch.ActiveForm.WindowState= FormWindowState.Normal Here is the method that is doing the calling: Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ctxShowWindow.Click MessageBox.Show("Not Operational yet!") frmWatch.ActiveForm.WindowState = FormWindowState.Normal End Sub Mike55 Edited November 23, 2004 by mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Administrators PlausiblyDamp Posted November 23, 2004 Administrators Posted November 23, 2004 It looks as though when you are minimizing the form it is no longer the active form - hence the Nullreference exception. Rather than rely on the active form could you not create a variable to store a reference to the form and use that to redisplay the form? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mike55 Posted November 23, 2004 Author Posted November 23, 2004 What, do the following dim x as new myWinform and the go x.show() of whatever function cause the form the appear. Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
donnacha Posted November 26, 2004 Posted November 26, 2004 x.showdialog will make the new form the focused form and will block any others being used. x.show on its own would allow the user to swap to another form and this might mess up your control. Quote Hamlet
mike55 Posted November 26, 2004 Author Posted November 26, 2004 Here is how I finally did it... If Me.WindowState = FormWindowState.Minimized Then Me.WindowState() = FormWindowState.Normal Me.Activate() End If Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
donnacha Posted November 27, 2004 Posted November 27, 2004 Are you keeping all you forms alive for the duration of the application and Minimizing/Mazimizing as needed. Have you considered what might happen if the user does an Alt-Tab and switches to a different one of your forms. It will totally mess up the control flow of your app. Quote Hamlet
mike55 Posted November 29, 2004 Author Posted November 29, 2004 Are you keeping all you forms alive for the duration of the application and Minimizing/Mazimizing as needed. Have you considered what might happen if the user does an Alt-Tab and switches to a different one of your forms. It will totally mess up the control flow of your app. I see where you are comming from, however its ok for this applications as it only has one form. Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
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.