DOTNET零碎要点---vb.net获取combox的选中值,删除Datagridview,选中值,处理提示框...

前端之家收集整理的这篇文章主要介绍了DOTNET零碎要点---vb.net获取combox的选中值,删除Datagridview,选中值,处理提示框...前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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

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. 原文链接:https://www.f2er.com/vb/259164.html

猜你在找的VB相关文章