1个回答
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'在一个按钮事件
'首先将表中所有行都显示
For Each row As DataGridViewRow In DataGridView1.Rows
row.Visible = True
Next
'判断显示的类型
If Button1.Text = "在职" Then
For Each row As DataGridViewRow In DataGridView1.Rows
If row.Cells(0).Value = "离职" Then
row.Visible = False
End If
Next
Button1.Text = "离职"
Else
For Each row As DataGridViewRow In DataGridView1.Rows
If row.Cells(0).Value = "在职" Then
row.Visible = False
End If
Next
Button1.Text = "在职"
End If
End Sub
啥也不多说,直接给代码,应该很好懂得
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询