1.ComboBox.SelectedValue属性值转化到相应的类型就行
注意ComboBox.SelectedValue==null时的空指针异常
3.str = ComboBox1.SelectedItem
可以获取选中的值
------------------------------------------------------------
4. For Each DataGridViewRow As DataGridViewRow In DataGridView1.SelectedRows
DataGridView1.Rows.RemoveAt(DataGridViewRow.Index)
Next
删除选中行
--------------------------------------
5.Rss = MessageBox.Show(Me, "确定要删除选中行数据码?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
Select Case Rss
Case DialogResult.Yes
MsgBox(Me.DataGridView1.SelectedRows.Count)
End Select
End Sub
---------------------------------------------------------
6. For i = DataGridView1.Rows.Count - 1 To 0 Step -1
Dim cells As DataGridViewCheckBoxCell
MsgBox(i)
cells = DataGridView1.Rows(i).Cells("selectmy")
If Convert.ToBoolean(cells.EditedFormattedValue) Then
dt.Rows.Add() End If
Next
删除选中的列
--------------------------------------------------------------
7. If Not IsDate(TextBox1.Text) Then
MsgBox("您的输入的日期有误,日期为8位纯数字")
Exit Sub
End If
8.
注意ComboBox.SelectedValue==null时的空指针异常
3.str = ComboBox1.SelectedItem
可以获取选中的值
------------------------------------------------------------
4. For Each DataGridViewRow As DataGridViewRow In DataGridView1.SelectedRows
DataGridView1.Rows.RemoveAt(DataGridViewRow.Index)
Next
删除选中行
--------------------------------------
5.Rss = MessageBox.Show(Me, "确定要删除选中行数据码?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
Select Case Rss
Case DialogResult.Yes
MsgBox(Me.DataGridView1.SelectedRows.Count)
End Select
End Sub
---------------------------------------------------------
6. For i = DataGridView1.Rows.Count - 1 To 0 Step -1
Dim cells As DataGridViewCheckBoxCell
MsgBox(i)
cells = DataGridView1.Rows(i).Cells("selectmy")
If Convert.ToBoolean(cells.EditedFormattedValue) Then
DataGridView1.Rows.RemoveAt(i) '这里只是逻辑删除,可以将要删除的数据保存到一个临时表里,然后当用户确实想删除的时候再更新数据库
dt.Columns.Add()dt.Rows.Add() End If
Next
删除选中的列
--------------------------------------------------------------
7. If Not IsDate(TextBox1.Text) Then
MsgBox("您的输入的日期有误,日期为8位纯数字")
Exit Sub
End If
判断用户输入的日期是否有误
注意:这里日期的格式要是1990-02-03才行要不然,isDate()会报错
-----------------------------------------------8.
作者:lidew521 发表于2013-2-28 20:20:07 原文链接
阅读:0 评论:0 查看评论