Working on a project, and trying to open my second form when a button is clicked. Only problem is that I can't seem to open said form because apparently form2.show isn't a thing anymore? Am I high or am I retarded? Help pls :)
|
C#
Is form2.show not a thing anymore? |
|
Be a little more specific, what does the error say, what exactly happened... Something more than "form2.show isn't a thing anymore"
Sep 6, 2018 07:35 PM
(This post was last modified: Sep 6, 2018 07:35 PM by 0xDEAD10CC.)
It was never a thing in C#... Learn how to instantiate classes and call methods properly. Only VB.NET has default instances.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer] (Sep 6, 2018 07:35 PM)0xDEAD10CC Wrote: It was never a thing in C#... Learn how to instantiate classes and call methods properly. Only VB.NET has default instances. Maybe try this : Code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click(Sep 7, 2018 06:35 AM)Le-coyote Wrote: Maybe try this : This is VB -.-, OP clearly wants it on C# This is what you need to do Code Form2 _form2 = new Form2();However this will initialize every single time a new form, if you don't want you can dispose it Жизнь это не те дни, что прошли, а те, что запомнились
Sep 7, 2018 01:16 PM
(This post was last modified: Sep 7, 2018 01:17 PM by Closed User.)
Disposable:
Code using (Form2 form = new Form2())I guess you could also do initialize a new form2 and set as property then call it like: Code Form2 form; //property(Sep 7, 2018 01:16 PM)Closed User Wrote: Disposable: Other events may happen before form Load event so why wouldn't you just use the constructor ? Unless the idea is to lazy initialize it but then you can just use Lazy<T>.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer] (Sep 7, 2018 01:16 PM)Closed User Wrote: Disposable: .Show is non-blocking. The form will flash up briefly then be disposed. Either use .ShowDialog which will suspend the use of the first form, or remove the using statement.
Lotta blood to let, peace to make, give a fuk about a check
|
|
|





![[Image: wyEbCMi.png]](https://i.imgur.com/wyEbCMi.png)
