Hello i'm working on my school project "roulette", but i got stuck and dont know how to continue, atm its working for just one bet.
I made bet system by two textbox, where you can type number and price of bet, and after click on button it goes to labels.
private void button4_Click(object sender, EventArgs e)
{
if (Int32.Parse(textBox1.Text) <=36) // Bet number
{
label4.Text = textBox1.Text; // Bet number from textbox will be trensfered to label, to see what was your bet
MessageBox.Show("Bet is complete");
}
else
{
MessageBox.Show("Bet number must be from 0 to 36. Bet again");
}
if (Int32.Parse(textBox2.Text) <= Int32.Parse(CreditNr.Text))
{
BetNumber = Int32.Parse(textBox2.Text);
BetNr.Text = BetNumber.ToString();
CreditNumber = (CreditNumber - BetNumber);
CreditNr.Text = CreditNumber.ToString();
label5.Text = textBox2.Text; // Bet will be transfered to label, to see what was your bet
MessageBox.Show("Bet is complete");
}
else
{
MessageBox.Show("You dont have enought money");
}
But it works only for one bet, is there any opinion how to make more bets, for example with listbox or etc? I need to save two values one will be, number and second is Value of bet. For example. I wanna play and will choice numbers 1 and bet 20€, 2 and bet 15€, and 3 and bet 30€. Now i need to save this information somwhere where i can work with them, For example 1 win so 20€ will be *36.
Do you have any ideas how to realize that? I thinked about two listbox one will be for number and second for bet. But don't know how to connect the values.
Use
listViewinstead oflistBoxOn form load add two column:
And when you creating a new bet just get the values and save to the listView