|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGridView ProblemHi all,
I have a Datagridview and I have added columns to it it is bound to a dataset table that is created in the code. The columns order is set and at the design view it appears just as I want it (I have textbox 5 columns and 1 button column that i want to appear at the end of the grid as last) but when I run the application the button column that is supposed to be last jumps to the second place. I have even tried to set the column order in code but with no luck. Can anyone help please? Brano wrote:
> Hi all, Did you turn off datagridview.autogeneratecolumns?> > I have a Datagridview and I have added columns to it it is bound to a > dataset table that is created in the code. The columns order is set and > at the design view it appears just as I want it (I have textbox 5 > columns and 1 button column that i want to appear at the end of the > grid as last) but when I run the application the button column that is > supposed to be last jumps to the second place. > > I have even tried to set the column order in code but with no luck. > > Can anyone help please? > Yes I did but no luck...
I have actually sorted it out the thing is i am populating the grid in code and I had to write a code to bound the items. But the main trick is to execute it after the grid is bound. Example: Dim drExists As System.Data.SqlClient.SqlDataReader drExists = PopulateDataReader(strSQL, My.Settings.ConnStr) If drExists.HasRows Then dgResults.DataSource = PopulateDataSet(strSQL, My.Settings.ConnStr).Tables(0) pnlGrid.Visible = True AdjustColumnOrder() End If Private Sub AdjustColumnOrder() With dgResults .Columns("DateIn").DisplayIndex = 0 .Columns("CustSurname").DisplayIndex = 1 .Columns("MiddleName").DisplayIndex = 2 .Columns("DOB").DisplayIndex = 3 .Columns("PostCode").DisplayIndex = 4 .Columns("btnSelect").DisplayIndex = 5 End With End Sub
Create Local Administrator
Cdbl & International Settings File in use can you add onMouseOver/onMouseOut to an ImageButton?? How to hide one column in datagrid? DateAdd function malfunctions? Dynamically remove child controls ? Step by step it works but... vb.net windows application that connects to the net. portability of applications |
|||||||||||||||||||||||