banger
banger
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
these
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
namespace BankAccountsApp
{
public partial class Form1 : Form
{


List<BankAccount> BankAccounts = new List<BankAccount>();


public Form1()
{
InitializeComponent();


dataGridView1.DataSource = BankAccounts;


}

private void CreateAccountBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(OwnerTxt.Text))
{
MessageBox.Show("Enter the username!");
return;
}

BankAccount bankAccount = new BankAccount(OwnerTxt.Text);
BankAccounts.Add(bankAccount);

RefreshGrid();
OwnerTxt.Text = string.Empty;
}


private void RefreshGrid()
{
dataGridView1.DataSource = null;
dataGridView1.DataSource = BankAccounts;

}

private void DepositBtn_Click(object sender, EventArgs e)
{
if(dataGridView1.SelectedRows.Count == 1 && AmountNum.Value > 0)
{
BankAccount selectedBankAccount = dataGridView1.SelectedRows
[0].DataBoundItem as BankAccount;

selectedBankAccount.Balance += AmountNum.Value;
RefreshGrid();
}
}
}
}
namespace BankAccountsApp
{
public partial class Form1 : Form
{


List<BankAccount> BankAccounts = new List<BankAccount>();


public Form1()
{
InitializeComponent();


dataGridView1.DataSource = BankAccounts;


}

private void CreateAccountBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(OwnerTxt.Text))
{
MessageBox.Show("Enter the username!");
return;
}

BankAccount bankAccount = new BankAccount(OwnerTxt.Text);
BankAccounts.Add(bankAccount);

RefreshGrid();
OwnerTxt.Text = string.Empty;
}


private void RefreshGrid()
{
dataGridView1.DataSource = null;
dataGridView1.DataSource = BankAccounts;

}

private void DepositBtn_Click(object sender, EventArgs e)
{
if(dataGridView1.SelectedRows.Count == 1 && AmountNum.Value > 0)
{
BankAccount selectedBankAccount = dataGridView1.SelectedRows
[0].DataBoundItem as BankAccount;

selectedBankAccount.Balance += AmountNum.Value;
RefreshGrid();
}
}
}
}
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
@Mayor McCheese
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
By the way on the first picture when u take your cursor to the row, the little arrow is shown on the left, it does not show up on my grid, and the second picture is the error it gives me when i try to select it
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
No description
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
When I get home i will provide the errors and other details
14 replies
CC#
Created by banger on 2/6/2025 in #help
Simple Bank program, DataGridView issue
:sadge:
14 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
okay thanks for the tips
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
thanks
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
alright
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
thanks jimacle
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
it took me like 20 minutes to fix such a simple code that i had errors not connected to the code at all
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
damn i finally fixed everything
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
i started whole new paper and now i get this error
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
No description
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
how can i fix it
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
@Jimmacle
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
No description
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
is there any reason why this code does not work?
int[] array1 = new int[4];
array1[0] = 45;
array1[1] = 7;
array1[2] = 3;
array1[3] = 8;


int[] array2 = new int[4];
array2[0] = 3;
array2[1] = 33;
array2[2] = 7;
array2[3] = 12;

int[] array3 = new int[4];


for (int i = 0; i < array1.Length; i++)
{
array3[i] = array1[i] + array2[array2.Length - 1 - i];
Console.WriteLine(array3[i]);
}
int[] array1 = new int[4];
array1[0] = 45;
array1[1] = 7;
array1[2] = 3;
array1[3] = 8;


int[] array2 = new int[4];
array2[0] = 3;
array2[1] = 33;
array2[2] = 7;
array2[3] = 12;

int[] array3 = new int[4];


for (int i = 0; i < array1.Length; i++)
{
array3[i] = array1[i] + array2[array2.Length - 1 - i];
Console.WriteLine(array3[i]);
}
it just does not work
37 replies
CC#
Created by banger on 11/26/2024 in #help
✅ I can't understand
thanks sir
37 replies