2013年5月23日木曜日

DataGridViewComboBoxColumnの初期値を入れる

DataGridViewComboBoxColumnの初期値を入れる

①まず、DataGridViewのCellFormattingイベントハンドラを追加
②そのイベントハンドラの中、下記を追加
  例の中、DataGridViewComboBoxColumnは第二列にある。
  
Private Sub m_dgvData_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles m_dgvData.CellFormatting
        If e.ColumnIndex = 1 Then ' Index of your DataGridViewComboBoxColumn 
            CType(m_dgvData.Rows(e.RowIndex).Cells(1), DataGridViewComboBoxCell).Value = 1
        End If
    End Sub

vb.net 背景色を消す、Nullにするには

vb.net 背景色を消す、Nullにするには

xx.Style.BackColor = Color.Empty

DataGridView 横スクロールバー非表示 問題の修正

DataGridView 横スクロールバー非表示 問題の修正

全てのColumnsのFrozen属性は'False' にしていることを確認。一つでも'True'にしたら、非表示になってしまうので、