Hi there,
I'm making a bible book app where I have listbox, richtextbox and search textbox.
I have som problem coding when the listbox text is chosen, It will show the listbox text + custom text in richtextbox.
I have done this:
private void btnAra_Click(object sender, EventArgs e)
{
int index = 0;
String temp = richTextBox1.Text;
richTextBox1.Text = "";
richTextBox1.Text = temp;
while (index < richTextBox1.Text.LastIndexOf(txtAra.Text))
{
richTextBox1.Find(txtAra.Text, index, richTextBox1.TextLength, RichTextBoxFinds.None);
richTextBox1.SelectionBackColor = Color.Orange;
index = richTextBox1.Text.IndexOf(txtAra.Text, index) + 1;
}
}
But since this is going to be a book app, I want the chosen listbox to show a text file in richtexbox and not only 2-3 sentences..
Any tip for what I can do?
Updated with this:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
var str = listBox1.SelectedItem.ToString();
if (str == " Yaratılış Tevrat")
{
richTextBox1.Text = str + "\t\r\n\nText here";
}
else if (str == " Mısır'dan Çıkış (Yasa)")
{
richTextBox1.Text = str + "\t\r\n\ncustom text 2";
}