Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Setting a column in an auto-generated DataGridView to visible = false with column name typo'd does not throw and error...

$
0
0

I have a C# 5/.NET 4.0 app with DataGridView objects in a Windows Form object.  The data is queried from the DB and the form load event has <datagridviewobject>.AutoGererateColumns = true;  which I follow with <datagridviewobject>.Columns[<string name of column>].Visible = false;  for the columns I do not want the user to see but need to push data into before updating the DB.

If I typo the column name, the form load event terminates at that point and no error state is raised and initially one believes that all is well until the results of the code below the errant line are needed.

This took me a long time to trouble shoot!

Is there a way to have such a mistake raise an error?


Newark IT Guy...


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>