I have the following form:
What I would like to do is have the last column be the second column and I am unable to figure out how to accomplish this. In the table adapter the last column is actually column 19 (of 19).
It appears to me, from this, that the columns can only be displayed in the order the columns are set in the tableadapter. That being the case, I have no idea how one would change the order of the columns so that I can arrange the columns in the DGV in the order I want them. I do know that I can change column order in a databound DGV using the DGV Task Window, but this cannot be applied for this particular DGV.
Code:Private Sub DocChangeListLoad() With dgvList .DefaultCellStyle.Font = New Font("Times New Roman", 11) .DefaultCellStyle.ForeColor = Color.Black .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter End With dgvList.DataSource = Me._MasterBase5_0DataSet dgvList.DataMember = "tblChangeRequest" With dgvList.Columns(0) .Visible = True .Width = 100 .HeaderText = "Change ID" .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter End With With dgvList.Columns(19) .Visible = True .Width = 100 .HeaderText = "Document ID" .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter End With With dgvList.Columns(1) .Visible = True .Width = 250 .HeaderText = "Title/Name" End With With dgvList.Columns(2) .Visible = True .Width = 100 .HeaderText = "Revision" End With dgvList.Columns(3).Visible = False dgvList.Columns(4).Visible = False dgvList.Columns(5).Visible = False dgvList.Columns(6).Visible = False dgvList.Columns(7).Visible = False dgvList.Columns(8).Visible = False dgvList.Columns(9).Visible = False dgvList.Columns(10).Visible = False dgvList.Columns(11).Visible = False dgvList.Columns(12).Visible = False dgvList.Columns(13).Visible = False dgvList.Columns(14).Visible = False dgvList.Columns(15).Visible = False dgvList.Columns(16).Visible = False dgvList.Columns(17).Visible = False dgvList.Columns(18).Visible = False End Sub




Reply With Quote
