C#C
C#3y ago
.blate.

Im trying to open a program but i tyink my code is not working

My code is:
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 == "51.55.157511955")
{
// 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);
}
}


}
}
Was this page helpful?