C
C#7mo ago
Bat

Im trying to open another program but my code isn't working

I made a login system. If login info is correct another program will open if its not it will tell wrong password or username. But it doesnt open the program.
3 Replies
Bat
Bat7mo ago
here is my code: using System; using System.Diagnostics; using System.Windows.Forms; namespace Gletch { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void btnLogin_Click(object sender, EventArgs e) { string username = txtUsername.Text; string password = txtPassword.Text; try { // Basit bir doğrulama kontrolü if (username == "admin" && password == "abc") { // Kullanıcı adı ve şifre doğruysa başka bir programı aç Process process = new Process(); process.StartInfo.FileName = @"C:\Users\bayza\Downloads\fabric-installer-0.11.2.exe"; process.StartInfo.UseShellExecute = true; process.Start(); } else { // Yanlış kullanıcı adı veya şifre durumunda burada bir hata mesajı gösteriyorum. MessageBox.Show("Yanlış Kullanıcı Adı veya Şifre", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { // Hata durumunda hatayı göster MessageBox.Show($"Hata: {ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } When i press login it doesnt work
Anchy
Anchy7mo ago
what do you mean by "doesnt work" what is it doing? also $codegif
Want results from more Discord servers?
Add your server
More Posts
Correct environments handling (appSettings.json)We are using azure DevOps and I wondered what's the best way to handle environments. Option 1: keep Can someone explain how I use MQTTnet and how MQTT in general works?MQTTnet: https://github.com/dotnet/MQTTnet Help would be really appreciated, thank you :)Can't call C++ function in Unity through mono_add_internal_call, with a MissingMethodExceptionthis is my question detail on stackoverflow: https://stackoverflow.com/questions/77478866/how-to-useIssues deserializing data using System.Text.Json when object fields are not known at runtime.I have a bit of an interesting problem deserializing from an external API using System.Text.Json. OnCan someone explain to me how this works``` public bool EliminarClienteXML(BE_Cliente cliente) { acceso = new DatosXML()Can't delete image cuz my own program is using it??You may know this exception error: can't delete the file because another process is using it, can an✅ Converting Time???```cs internal string CheckTimeFormat(string input, string message) { string format = @"hh\:mm\:✅ Reading Time Stamps From Database and Summing Time c#so I'm reading time stamps from a database, and I need to sum the total time ```cs // database file ✅ XUnit, ParallelTests, and HtmlReport (ExtentReports)What's a good way to run ParallelTests with Xunit and ExtentReport (or other) ? My problem is thatWindows Forms does not show image when using pictureBox1.Visible and returns "System.Drawing.Bitmap"Someone please help me. I don't know why this is happening. I've been able to show images just fine