Soggy
Soggy
CC#
Created by Soggy on 12/2/2023 in #help
User Control Eventhandler. How to get my control's components to inherit an Eventhandler.
but yeah pretty much, that's what I want.
6 replies
CC#
Created by Soggy on 12/2/2023 in #help
User Control Eventhandler. How to get my control's components to inherit an Eventhandler.
no it's readonly and only for display, label doesn't dock properly so I use a textbox
6 replies
CC#
Created by Soggy on 12/2/2023 in #help
User Control Eventhandler. How to get my control's components to inherit an Eventhandler.
something like this also doesn't work
public BoxButton() : base()
{
InitializeComponent();
Picture.Click += this.Click;
TextBox.Click += this.Click;
}
public BoxButton() : base()
{
InitializeComponent();
Picture.Click += this.Click;
TextBox.Click += this.Click;
}
Error CS0079 "The event 'Control.Click' can only appear on the left hand side of += or -="
6 replies
CC#
Created by Soggy on 12/2/2023 in #help
User Control Eventhandler. How to get my control's components to inherit an Eventhandler.
some things I've tried include: Doesn't work with windows designer code due to syntax, I have to manually type BoxButton.Click = BoxButton_Click rather than BoxButton.Click += BoxButton_Click.
public new EventHandler? Click
{
set
{
Picture.Click += value;
TextBox.Click += value;
base.Click += value;
}
}
public new EventHandler? Click
{
set
{
Picture.Click += value;
TextBox.Click += value;
base.Click += value;
}
}
Doesn't work :<
private void picture_click(object sender, EventArgs e) => this.Click += picture_click;
private void text_click(object sender, EventArgs e) => this.Click += text_click;
private void picture_click(object sender, EventArgs e) => this.Click += picture_click;
private void text_click(object sender, EventArgs e) => this.Click += text_click;
6 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
it won't close properly though >:(
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
yeh, anyways
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
it is an event handler, or at least i treat it like it is
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
I want to close LoginForm and open MainForm without any shenanigans
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
I start with LoginForm, which has this code
public async void LogIn(string username, string password)
{
//code

new MainForm(client).Show();
this.Close();
}
public async void LogIn(string username, string password)
{
//code

new MainForm(client).Show();
this.Close();
}
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
So the problem I have now is idk how to transfer control to MainForm
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
idk the right funny functions
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
same with load
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
It was just a place holder
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
This is what's weird, isn't MainForm only a local thingy in LoginForm, so what happens to it when I close it
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
public MainForm(Client client)
{
InitializeComponent();
ActiveClient = client;
}
public MainForm(Client client)
{
InitializeComponent();
ActiveClient = client;
}
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
My code now looks like this
public async void LogIn(string username, string password)
{
//code

new MainForm(client).MainForm_Load();
this.Close();
}
public async void LogIn(string username, string password)
{
//code

new MainForm(client).MainForm_Load();
this.Close();
}
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
@xtreit how do I keep my MainForm from closing when I close LoginForm?
35 replies
CC#
Created by Soggy on 11/27/2023 in #help
Windows Form, how to await for user input in a constructor.
Lemmie try that
35 replies