I have a vb.net grid bound to a table. There many ways that I have designed in to search the data in the table. All is well until I want to reorder the columns. Specifically I want to place the term searched 'search' field in the first column. The column name below for [state] works great. The column name for [Last Name] does not work; instead throwing an exception indicating the data field is not found. I am sure that the field name is correct as I have copied it out of the grid properties into the code. I tried other single word fields which all work fine. Fields such as [First Name] and [Last Name] don't work at all with the same exception taken.
I surmise that I need to wrap the "two-word" field names differently. Ideas?
Does not work: Master_ContactsDataGridView.Columns("Last Name").DisplayIndex = 1
Works: Master_ContactsDataGridView.Columns("State").DisplayIndex = 2