如何创建除一个数据网格列

时间:2016-09-03 05:01:48

标签: vb.net datagridview

我有一个datagridview,它看起来像这样

Datagridview Column

我的问题是如何将所有列设置为除月份列之外的复选框列?

到目前为止,这是我的代码

  Dim con1 As MySqlConnection = New MySqlConnection("server=192.168.2.87;userid=root;password=admin1950;database=inventory")
    Dim sql1 As MySqlCommand = New MySqlCommand("Select * from period_closure", con1)
    Dim ds1 As DataSet = New DataSet
    Dim adapter1 As MySqlDataAdapter = New MySqlDataAdapter
    con1.Open()
    adapter1.SelectCommand = sql1
    adapter1.Fill(ds1, "MyTable")
    DataGridView1.DataSource = ds1.Tables(0)
    con1.Close()
    Me.DataGridView1.Columns(0).Frozen = True
    Dim i As Integer
    For i = 0 To DataGridView1.Columns.Count - 1
        DataGridView1.Columns.Item(i).SortMode = DataGridViewColumnSortMode.Programmatic
    Next i

我试过这段代码

For Each row in DatagridviewRow in Datagridview1.rows + 1
'+1 so the column month will not be affected
dim check as checkboxcolumn
row = checkboxcolumn
next

它不起作用

TYSM寻求帮助

1 个答案:

答案 0 :(得分:0)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="box"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer pellentesque dui ut nisl iaculis faucibus. Mauris non diam consectetur metus accumsan sollicitudin. Quisque ornare euismod mi. </div> <div class="box"></div> <div class="box"></div> <div class="box"></div>填充列之后添加此行,但之前将数据绑定到DataSet

DataSet