using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void quitbtn_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void loginbtn_Click(object sender, EventArgs e)
{
if (usertext.Text=="")
{
MessageBox.Show("Enter Username");
}
else if (passtext.Text=="")
{
MessageBox.Show("Enter Password");
}
else
{
if(usertext.Text=="admin")
{
if (passtext.Text== "adminpass")
{
Class1 class1 = new class1();
Class1.Show();
}
else
{
MessageBox.Show("Invalid Login");
}
}
}
}
}
}Открытие новой формы после успешной регистрации
Так что я в настоящее время это очень простой для входа в веб-форму, где когда я ввожу правильное имя пользователя и пароль, он открывает консольное приложение. Я не уверен, что я делаю это правильно, потому что я продолжаю получать ошибку сборки.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LoanCalculator
{
class Class1
{
static void Main(string[] args)
{
// declare variables
double principle = 0;
double years = 0;
double interest = 0;
string principleInput, yearsInput, interestInput;
// User input for Principle amount in dollars
Console.Write("Enter the loan amount, in dollars(0000.00): ");
principleInput = Console.ReadLine();
principle = double.Parse(principleInput);
//Prompt the user to reenter any illegal input
if (principle < 0)
{
Console.WriteLine("The value for the mortgage cannot be a negative value");
principle = 0;
}
// User input for number of years
Console.Write("Enter the number of years: ");
yearsInput = Console.ReadLine();
years = double.Parse(yearsInput);
//Prompt the user to reenter any illegal input
if (years < 0)
{
Console.WriteLine("Years cannot be a negative value");
years = 0;
}
// User input for interest rate
Console.Write("Enter the interest rate(%): ");
interestInput = Console.ReadLine();
interest = double.Parse(interestInput);
//Prompt the user to reenter any illegal input
if (interest < 0)
{
Console.WriteLine("The value for the interest rate cannot be a negative value");
interest = 0;
}
//Calculate the monthly payment
//ADD IN THE .Net function call Math.pow(x, y) to compute xy (x raised to the y power).
double loanM = (interest/1200.0);
double numberMonths = years * 12;
double negNumberMonths = 0 - numberMonths;
double monthlyPayment = principle * loanM/(1 - System.Math.Pow((1 + loanM), negNumberMonths));
//double totalPayment = monthlyPayment;
//Output the result of the monthly payment
Console.WriteLine(String.Format("The amount of the monthly payment is: {0}{1:0.00}", "$", monthlyPayment));
Console.WriteLine();
Console.WriteLine("Press the Enter key to end. . .");
Console.Read();
}
}
}
Ничего себе, что много кода, больше, чем нужно для этого вопроса. В любом случае попробуйте выполнить поиск в окне входа в систему C# в Интернете, и вы найдете то, что ищете. –
Что такое ошибка сборки? – dbc