MotherBroker
MotherBroker
CC#
Created by MotherBroker on 2/21/2024 in #help
✅ Detect key press outside of the form
Hello i'm working with c# windows forms. My form has a transparent panel that i can click and see through. How can i capture the key pressings when not focused on the main form ??
88 replies
CC#
Created by MotherBroker on 9/3/2023 in #help
❔ ui page : button offset
9 replies
CC#
Created by MotherBroker on 3/27/2023 in #help
❔ c# wpf textbox access violation
Hello does anyone know how can i edit the TextBox1.Text within the Task.run so i don't have an access violation ? here is the code :
private async void Button_Click(object sender, RoutedEventArgs e)
{
try
{
Socket Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Server.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80));
Server.Listen(2);

Socket Client;

await Task.Run(() =>
{
Client = Server.Accept();
TextBox1.Text = "Hello";

});
}

catch (Exception ex)
{
Console.WriteLine("Exception: " + ex);
}
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
try
{
Socket Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Server.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80));
Server.Listen(2);

Socket Client;

await Task.Run(() =>
{
Client = Server.Accept();
TextBox1.Text = "Hello";

});
}

catch (Exception ex)
{
Console.WriteLine("Exception: " + ex);
}
}
6 replies