我在编辑 datagridview 的宽度时遇到问题。它没有改变宽度。这是我的源代码。
oDotNet.SqlDb.strCommand = "SELECT TOP 1 ItemCode, ItemName FROM [" & oAPP.oSQLDatabase & "]..OITM"
dgMain.DataSource = oDotNet.SqlDb.Ds.Tables(0).DefaultView
Dim oTableStyle As New DataGridTableStyle
oTableStyle.MappingName = oDotNet.SqlDb.Ds.Tables(0).DefaultView.GetType().Name
Dim oTextBoxColumn As New DataGridTextBoxColumn
oTextBoxColumn.Width = 400
oTextBoxColumn.MappingName = "ItemName"
oTextBoxColumn.HeaderText = "ItemName"
oTableStyle.GridColumnStyles.Add(oTextBoxColumn)
dgMain.TableStyles.Clear()
dgMain.TableStyles.Add(oTableStyle)
问候