我想用轮盘游戏填充 ListBox,但我需要跳过不起作用的行
如果中奖号码不匹配,列表框必须打印如下
抱歉没有中奖号码!
你松了!!!
如果中奖号码与投注号码相符,则应如下所示:
中奖号码#
赌注:R#
投注类型:#
总奖金:R#
注意:#代表选择的数字
我尝试了“/n”和“system.Enviroment.NewLine”两种方式,但似乎没有任何效果
protected void btnSpin_Click(object sender, EventArgs e)
{
Random random = new Random();
intNumbRolled = random.Next(36);
if (intNumb == intNumbRolled)
{
winning = intBet * type;
}
else
{
winning = 0;
}
if (winning == 0)
{
ListBox1.Items.Add
("Sorry there was no winning number \nYou loose!!");
}
else
{
ListBox1.Items.Add ("Winning number is " + intNumbRolled +
System.Environment.NewLine + System.Environment.NewLine + "BET: R " +
intBet + System.Environment.NewLine + "Bet-Type: " + type +
System.Environment.NewLine + "Total Winnings: R " + winning);
}
}
有人可以帮忙吗?