![]() |
|
[C#] Is form2.show not a thing anymore? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Is form2.show not a thing anymore? (/showthread.php?tid=5882232) |
Is form2.show not a thing anymore? - NotAFed - Sep 6, 2018 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 :) RE: Is form2.show not a thing anymore? - VmX5 - Sep 6, 2018 Be a little more specific, what does the error say, what exactly happened... Something more than "form2.show isn't a thing anymore" RE: Is form2.show not a thing anymore? - 0xDEAD10CC - Sep 6, 2018 It was never a thing in C#... Learn how to instantiate classes and call methods properly. Only VB.NET has default instances. RE: Is form2.show not a thing anymore? - Le-coyote - Sep 7, 2018 (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.ClickRE: Is form2.show not a thing anymore? - StarZ - Sep 7, 2018 Code Form2 newForm = new Form2();RE: Is form2.show not a thing anymore? - Dotexe - Sep 7, 2018 (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 RE: Is form2.show not a thing anymore? - Closed User - Sep 7, 2018 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; //propertyRE: Is form2.show not a thing anymore? - 0xDEAD10CC - Sep 10, 2018 (Sep 7, 2018 01:16 PM)Big Benim 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>. RE: Is form2.show not a thing anymore? - BahNahNah - Sep 10, 2018 (Sep 7, 2018 01:16 PM)Big Benim 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. |