❔ How do I close the authorization window after the user has logged in?
I implemented it this way, but in this case my memory is heavily loaded, so a new window is created every time
28 Replies
perhaps show it as a dialog instead?
IDK.ShowDialog()
It works. And how to hide the authorization window so that it is not visible when the IKD is open?
not enough information. You've shown literally 3 lines of code.
I dont know what your "authorization window" is
I thought that was the IKD
LoginWindow:
IKD:
ok so IKD owns Form1
ah I see, you actually have a weird loop
yep
IKD creates and owns a form 1, but a Form1 also creates/owns an IKD.. and another form1?
do you understand what happens each time you do
new Form1();
?LoginWindow=Form1
no
it creates a NEW form instance
unrelated to the previous ones
o no
how to avoid this?
I just don't understand how to do it right without creating unrelated windows.
you need to reuse and pass your object references around
first, which form is your main form, the one that loads when your program starts?
Form1, which is the authorization window
.
Okay. So, there are a few ways to do this.
Are there ever a reason to show the login form again after the user goes through it the first time?
No
Im in the middle of some stuff, I can help in 20ish min
no prob
Ok so the idea is that you in
Form1
create a single IKD instance, probably as a field
in your button click event, you do
nothing else.
and in IKD, remove this:
you said there was no point in "going back" from IKD, so lets remove thatI probably will, but I would still like to try to do it in order to use it in the future
?
I don't follow.
I'm still trying to implement it as you showed above, but I can't.
Before that there was an error "Please use language version 9.0 or greater", but I have already fixed it
thats the IKD code
it cant use the
_ikd
variable, thats only in Form1
Please use language version 9.0 or greateroh no, are you using .NET Framework 4.x instead of .NET 7?
yes, this is the latest version that is available when creating a WinForms project
it is not
you absolutely can make winforms projects on .NET 7
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
should I have chosen the second when creating the project?
yes
Okay, thx ❤️
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.