code:
using System;
using System.Windows.Forms;
namespace WindowsFormsControlLibrary1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.textBox1.Text == "admin" && this.textBox2.Text == "admin")
{
MessageBox.Show("Login Successfully");
UserForm dashboard = new UserForm();
this.ParentForm.Hide();
dashboard.ShowDialog();
this.ParentForm.Close();
}
else
{
MessageBox.Show("Login Error");
}
}
}
}
Mainform:
Output: