Form1 kodlari
void btnLogin_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ password = txtPassword->Text;
if (password == "Munira")
{
Form2^ form2 = gcnew Form2();
form2->Show();
}
else
{
MessageBox::Show("Parol xato.", "Xato", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
Form2 kodlari
void btnCalculate_Click(System::Object^ sender, System::EventArgs^ e)
{
int month = Convert::ToInt32(txtMonth->Text);
int year = Convert::ToInt32(txtYear->Text);
if (month < 1 || month > 12 || year < 1)
{
MessageBox::Show("Invalid month or year.", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
return;
}
int daysInMonth = DateTime::DaysInMonth(year, month);
String^ message = String::Format("Number of days in {0}/{1}: {2}", month, year, daysInMonth);
MessageBox::Show(message, "Day Count", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
Natija
Do'stlaringiz bilan baham: |