System.windows.forms.form.show


















Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. So, I'm struggling a little bit here. I am writing a windows console application in C and have just made a login form for the application called frmLogin.

I tried using the MS documented method of;. In my main application, I want to be able to show the login form programmatically, but when I try to use;. ShowDialog '. In the old days, I could show a form by simply using the above snippet of code.

So, obviously something has changed since the last time I wrote a windows console app. Which, of course, is a blank form. It would appear that your type is called frmLogin.

Normally this sounds like a variable name and not a class name, but the error you're getting here tells me that it's a class:. Given that, then the quickest way to solve your problem would be to create an instance of your form and show it:.

However , in keeping with naming standards and conventions to help prevent future confusion and problems , I highly recommend renaming the form itself to something like:. Then you can use something like frmLogin as the variable name, which is a much more common approach:. The problem is that with the code snippet you took from Microsoft, you were just building the base Type. You need to build your form. So instead of new Form , you build a new frmLogin :.

If this doesn't solve your problem, I will delete my answer but, I am assuming that you aren't instantiating your form:. This works just fine for me.

Although personally, I would simply use the. Show method:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? The form specified in the owner parameter is the same as the form being shown. The current process is not running in user interactive mode for more information, see UserInteractive.

You can use this method to display a non-modal form. When you use this method, the Owner property of the form is set to owner. The non-modal form can use the Owner property to get information about the owning form. Calling this method is identical to setting the Owner property of the non-modal and then calling the Show method. Showing the form is equivalent to setting the Visible property to true. After the Show method is called, the Visible property returns a value of true until the Hide method is called.

When the user clicks the Help button, the Help file specified in the helpFilePath parameter is opened. When the user clicks the Help button, the help file specified in the helpFilePath parameter is opened and the Help content identified by the navigator parameter is displayed.

Compiled Help files provide table of contents, index, search, and keyword links in pages. One of the MessageBoxDefaultButton values the specifies the default button for the message box. These two options should be used only if you invoke the version of this method that does not take an owner parameter.

The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox , offering the user the option to cancel the operation. If the Show method's return value evaluates to Yes , the form that displayed the MessageBox is closed.

When the user clicks Help button, the Help file specified in the helpFilePath parameter is opened. The default is false. The following code example demonstrates how to show a message box with a Help button, handle the Control. HelpRequested event, and show a custom help window in response to the event. When the user clicks the Help button, the form that owns the message box or the active form receives the HelpRequested event.

Handle the HelpRequested event to perform custom Help actions. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox with a question box icon, offering the user the option to cancel the operation. The buttons parameter specified is not a member of MessageBoxButtons.

The icon parameter specified is not a member of MessageBoxIcon. The following code example demonstrates one of the Show methods when handling the ComboBox. DropDown event. To run the example, paste the following code in a form and call the InitializeComboBox method from the form's constructor or Load method.

The example uses the RightAlign member of the MessageBoxOptions enumeration to align the text to the right edge of the dialog box. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Message Box. Show Method Reference Is this page helpful?

Please rate your experience Yes No. Any additional feedback?



0コメント

  • 1000 / 1000