manually set backcolor of header in datagrid..help
-
I have manually created a dataset, populated a datagrid with that dataset, and I want to change the background color of certain headerstyles for certain columns. I am trying to do it this way: datagrid.columns(0).HeaderStyle.BackColor = Color.Green I always get this error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Does anyone know what process I need to go about in order to be able to do this? THanks Cavall "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
I have manually created a dataset, populated a datagrid with that dataset, and I want to change the background color of certain headerstyles for certain columns. I am trying to do it this way: datagrid.columns(0).HeaderStyle.BackColor = Color.Green I always get this error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Does anyone know what process I need to go about in order to be able to do this? THanks Cavall "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
It sounds like you are using the "create columns automatically at run time" feature of the data grid. Your code should work if you pre-define the columns manually.
-
It sounds like you are using the "create columns automatically at run time" feature of the data grid. Your code should work if you pre-define the columns manually.
I am using the "creat auto..." feature.... So I have to predefine the entire datagrid before hand in order to manually manipulate its properties? I was under the impression that after the datagrid was binded to the dataset and created that I could manipulate it from there. Thanks Cav "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson