Context: Windows Forms, C# and (slightly better class) design.
I'm an unseasoned programmer. Currently, buidling up a form is not a big deal issue yet. However, programming the object oriented way is. I consider myself confident having
basic knowledge about inherritance, aggregation, overriding, interfaces and abstract classes. But putting the pieces together is something I can't do yet. Here is a small example of what I currently have
and then I'll explain what I want to achieve.
This I have in the Form1 class which the IDE generated for me:
private void dgvIRB_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
//1. Color cells red if unwanted character(s) are found in a cell
string unwantedCharacters = "\";][:\\|/!@#$%^&*()+=";
if (e.Value != null)
if (e.Value.ToString().IndexOfAny(unwantedCharacters.ToCharArray()) >= 0)
e.CellStyle.BackColor = Color.Red;
I don't want these kind of details in the form class. There are going to be tons of these rules. So I want to have a dedicated class checking for all these rules which will trigger the coloring of cells, columns and/or rows if something
View Complete Post