2013-04-15 39 views
0

我在編輯datagridview的寬度時遇到問題。它不會改變寬度。這是我的源代碼。Windows Mobile中DataGrid的列寬

 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) 

問候

+0

有什麼建議? –

回答

1

刪除以下行並執行它的工作原理:

oTableStyle.MappingName = oDotNet.SqlDb.Ds.Tables(0).DefaultView.GetType().Name