In the form1 constructor i set the textBox forecolor to be in green:
cTextBox3.WaterMarkForeColor = Color.Green;
cTextBox3.WaterMarkActiveForeColor = Color.Green;
cTextBox3.ForeColor = Color.Green;
cTextBox3.WaterMark = "Browse To The File Location";
Then i have a button click event with openFileDialog
private void button6_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.Filter = "Json Files (*.json)|*.json";
openFileDialog1.FilterIndex = 0;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.Multiselect = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
cTextBox3.Text = openFileDialog1.FileName;
w = new StreamWriter(AuthenticationFileName, true);
w.WriteLine(cTextBox3.Text);
w.Close();
}
}
In the designer i set the cTextBox3 ReadOnly property to true.
The problem is once the text of the openFileDialog1.FileName is assigned to the cTextBox3.Text the text is in black. And i want it to be in green. I tried to add before the line:
cTextBox3.Text = openFileDialog1.FileName;
All the colors changes like i did in the constructor to green i tried to set the cTextBox3 ReadOnly property to false set the colors again then set it to true again and still the text is in black.