Thanks for the suggestion, I'll use the GridDataBoundGrid and edit the properties you suggested. Basically, I want to accomplish the following:
1.) Load records into the control from a custom collection, but I want the columns to be displayed in a different order than how it's declared in the collection class.
2.) I want the control to have a spreadsheet look, I don't know if this is possible. What I mean is that I want the control to be filled with rows, even if there is no data in them. I think I can set the amount of rows I want displayed in the grid and then use the populate method to copy the values from my collection to the GridDataBoundGrid. Is this correct, or do I have to use the GridControl to do this?
3.) I would like the columns to adjust their width to fit the entire width of the control. Is there a way to have the columns adjust to the size of the grid control automatically, or do I have to set the width of each cell manually?
4.) I would also like to have the whole row selected when the end user clicks on any field in a row.
Thanks in advance, your help is much appreciated.
Andrew
> > Is there a way to get the same results (see code snippet below) with the GridListControl? I want to rearrange the order in which my columns are displayed in the GridListControl. I'm binding to a custom collection class.
> >
> >
> > gbc = New GridBoundColumn
> > gbc.MappingName = "BillingStreetAddress"
> > gbc.HeaderText = "Street Address"
> > grdResults.GridBoundColumns.Add(gbc)
> >
> > Thanks in advance,
> >
> > Andrew
>
> It is not as easy. The GridListControl started life as a sample, and its primary purpose was to serve as the list part of a multicolumn dropdown list for a grid cell. So, it does not have all the property structures that let you easily design it.
>
> In a lot of cases, it is simpler to use either a GridDataBoundGrid or a GridControl, jsut setting the ListBoxSelectionMode to make these controls behave like a list. You can hide teh row headers, and handle the CurrentCellActivating evet setting e.ColIndex = 0 to get more or less the exact same look. You cn also make grid.TableStyle.CellType = "Static" to avoid all editing problems.
>
> If you use one of these controls, you can set the headertext using code like you suggested above or something equivalent for a GridControl.
>
> If you really need teh GridListControl foe some reason (maybe your design required a ListBox derived class), then you can change teh headertext but it is a little more more. you have to get at the embbedded GridControl, gridListControl1.Grid. But even if you get at this control, since the GridListControl uses this embedded grid in a virtual manner, you have to handle the QueryCellInfo event, an dprovide the header text on demand.
>
>
> ’add the handler say in the form’s Load event
> AddHandler GridListControl1.Grid.QueryCellInfo, AddressOf HandleGridQueryCellInfo
>
> ’here is the handler that changes the title of column 1 to "NewTitle"
> Private Sub HandleGridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
> If e.ColIndex = 1 And e.RowIndex = 0 Then
> e.Style.Text = "NewTitle" ' for col 1
> e.Handled = True
> End If
> EndSub
>
>
>