above are what details to be shown when you click the check box and what is to be hidden when its not checked. I have no clue how to do this and I am sure its simple. But any help would be appreciated as I am pretty new to this. Thanks
Assuming you are using a RichTextBox, you save all the lines to a variable of type array of strings, and you save the lines that contain 'Deposit" in an other variable of the same type.
public partial class Form1 : Form
{
string[] LinesWithDetails;
string[] LinesWithOutDetails;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
LinesWithDetails = richTextBox1.Lines;
LinesWithOutDetails = richTextBox1.Lines.Where(l => l.Contains("Deposit")).ToArray();
HideDetails();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
ShowDetails();
else
HideDetails();
}
private void ShowDetails()
{
richTextBox1.Lines = LinesWithDetails;
}
private void HideDetails()
{
richTextBox1.Lines = LinesWithOutDetails;
}
}