I am trying to make a game in which a richTextBox will have a biblical text and the buttons will have the name of the appointment shown randomly through a List. I have no problems generating the text of the buttons, but how I have to show a text in the richTextBox when I open the page at the end I have no more text to assign to the richTextBox.
public void EscogerCita()
{
while (citas.Count != 0)
{
Random random = new Random();
index = random.Next(citas.Count);
citaTxt.Add(citas[index]);
citas.RemoveAt(index);
}
}
private void AsignarCitaBtn()
{
while (botones.Count != 0)
{
Random rnd = new Random();
int index = rnd.Next(botones.Count);
txtBtns.Add(botones[index]);
botones.RemoveAt(index);
}
Btn.Text = txtBtns[0];
Btn2.Text = txtBtns[1];
Btn3.Text = txtBtns[2];
Btn4.Text = txtBtns[3];
Btn5.Text = txtBtns[4];
Btn6.Text = txtBtns[5];
txtBtn = Btn.Text;
txtBtn2 = Btn2.Text;
txtBtn3 = Btn3.Text;
txtBtn4 = Btn4.Text;
txtBtn5 = Btn5.Text;
txtBtn6 = Btn6.Text;
}
private void button1_Click(object sender, EventArgs e)
{
if (txtBtn == "Filipenses 4:13" && "Todo lo puedo en Cristo." == richTextBox1.Text)
{
MessageBox.Show("Muy Bien!!!");
label1.Text = "Puntos:" + Convert.ToString(puntos);
richTextBox1.Text = citaTxt[1];
Btn.Visible = false;
}
else
{
MessageBox.Show("Estas Mal!!");
Btn.Visible = false;
richTextBox1.Text = citaTxt[1];
}
}
private void Btn2_Click(object sender, EventArgs e)
{
if (txtBtn2 == "Juan 3:16" && "Porque de tal manera amó Dios al mundo, que ha dado a su Hijo unigénito para que todo el que cree en El, no se pierda, mas tenga vida eterna." == richTextBox1.Text)
{
MessageBox.Show("Muy Bien!!!");
puntos += 5;
label1.Text = "Puntos:" + Convert.ToString(puntos);
richTextBox1.Text = citaTxt[2];
Btn2.Visible = false;
}
else
{
MessageBox.Show("Estas Mal!!");
Btn2.Visible = false;
richTextBox1.Text = citaTxt[2];
}
}
private void Btn3_Click(object sender, EventArgs e)
{
if (txtBtn3 == "2da Timoteo 3:16-17" && "Toda la Escritura es inspirada por Dios, y útil para enseñar, para redarguir, para corregir, para instruir en justicia a fin de quel el hombre de Dios sea perfecto, eternamente preparado para toda buena obra." == richTextBox1.Text)
{
MessageBox.Show("Muy Bien!!!");
puntos += 5;
label1.Text = "Puntos:" + Convert.ToString(puntos);
richTextBox1.Text = citaTxt[3];
Btn3.Visible = false;
}
else
{
MessageBox.Show("Estas Mal!!");
Btn3.Visible = false;
richTextBox1.Text = citaTxt[3];
}
}
private void Btn4_Click(object sender, EventArgs e)
{
if (txtBtn4 == "Salmos 23:6" && richTextBox1.Text == "Ciertamente el bien y la misericordia me seguirán todos los días de mi vida y en la casa de Jehová moraré por largos días.")
{
MessageBox.Show("Muy Bien!!!");
puntos = +5;
label1.Text = "Puntos:" + Convert.ToString(puntos);
Btn4.Visible = false;
richTextBox1.Text = citaTxt[4];
}
else
{
MessageBox.Show("Estas Mal!!");
Btn4.Visible = false;
richTextBox1.Text = citaTxt[4];
}
}
private void Btn5_Click(object sender, EventArgs e)
{
if (txtBtn5 == "Salmos 91:1" && richTextBox1.Text == "El que habita al abrigo del Altísimo morará bajo la sombra del omnipotente.")
{
MessageBox.Show("Muy Bien!!!");
puntos += 5;
label1.Text = "Puntos:" + Convert.ToString(puntos);
Btn5.Visible = false;
richTextBox1.Text = citaTxt[5];
}
else
{
MessageBox.Show("Estas Mal!!");
Btn5.Visible = false;
richTextBox1.Text = citaTxt[5];
}
}
private void Btn6_Click(object sender, EventArgs e)
{
if (txtBtn6 == "Romanos 5:1" && richTextBox1.Text == "Justificados, pues, por la fe, tenemos paz para con Dios por medio de nuestro Señor Jesucristo.")
{
MessageBox.Show("Muy Bien!!!");
Btn6.Visible = false;
}
else
{
MessageBox.Show("Estas Mal!!");
Btn6.Visible = false;
}
}
}
If you can observe the Btn6 button, you do not have to generate a new text, that is, if you press that button at the beginning, a new text will not be generated and the game will be damaged.
What solution do you recommend?
Here are the lists and their content
List<string> citas = new List<string>();
List<string> citaTxt = new List<string>();
List<string> botones = new List<string>();
List<string> txtBtns = new List<string>();
citas.Add("Todo lo puedo en Cristo.");
citas.Add("Porque de tal manera amó Dios al mundo, que ha dado a su Hijo unigénito para que todo el que cree en El, no se pierda, mas tenga vida eterna.");
citas.Add("Toda la Escritura es inspirada por Dios, y útil para enseñar, para redarguir, para corregir, para instruir en justicia a fin de quel el hombre de Dios sea perfecto, eternamente preparado para toda buena obra.");
citas.Add("Ciertamente el bien y la misericordia me seguirán todos los días de mi vida y en la casa de Jehová moraré por largos días.");
citas.Add("El que habita al abrigo del Altísimo morará bajo la sombra del omnipotente.");
citas.Add("Justificados, pues, por la fe, tenemos paz para con Dios por medio de nuestro Señor Jesucristo.");
botones.Add("Filipenses 4:13");
botones.Add("Juan 3:16");
botones.Add("2da Timoteo 3:16-17");
botones.Add("Salmos 23:6");
botones.Add("Salmos 91:1");
botones.Add("Romanos 5:1");