With a csv file looking like this:
usernames,passwords
us1,ps1
us2,ps2
I would like all usernames in one array an all passwords in another.
Current code: (Trying to make a login system that interacts with a database.)
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;
using System.Diagnostics;
using System.Globalization;
namespace Login
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[] usernames = new string[] { };
string[] passwords = new string[] { };
private void btnLogin_Click(object sender, EventArgs e)
{
lblLoginSucsess.Text = "";
for (int i = 0; i < Math.Min(usernames.Length, passwords.Length); i++)
{
if ((usernames[i].ToLower() == txtUsnme.Text.ToLower()) && (passwords[i].ToLower() == txtPass.Text.ToLower()))
{
lblLoginSucsess.Text = $"Welcome, {txtUsnme.Text}.";
// run calc
Process.Start("C:/Users/finch/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/HP Inc/Calculator.appref-ms");
}
}
}
}
}
If you can help, Thanks.