0

我在编辑 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)

问候

4

1 回答 1

1

删除下面的行并执行它的工作:

  oTableStyle.MappingName = oDotNet.SqlDb.Ds.Tables(0).DefaultView.GetType().Name
于 2013-05-20T13:29:21.170 回答