我不知道如何通过选择单选按钮选项(全职或兼职)在数据网格视图中显示数据



我需要使用两个无线电按钮,一个parttimeradiobutton和fulltimeradiobutton在datagridview中显示适当的信息。当某人选择"广播"按钮时,它将仅显示那些全职或仅是兼职的人。我不知道如何启动这个问题。我知道如何通过:

显示所有这些

salesdatagridview.datasource = customers.items

探测器来自客户的课程,但以这种形式更名为刺激者。我已经连接了该项目设计的屏幕截图。我还必须在11:59 pm之前完成此操作,并且不知道该怎么做。

客户类代码是:

Public Class Customers
'create a object variable (tableadapter)
'this will be used to creat instances of this class in the form
Private adapter As New CompanyDataSetTableAdapters.SalesStaffTableAdapter
'property to return a table using the GetData method
Public ReadOnly Property Items() As DataTable
    Get
        Dim table As DataTable = adapter.GetData
        table.DefaultView.Sort = "First_Name"
        Return table
    End Get
End Property
'create a function to filter the customers by custid
Public Function GetByCustomerId(custid As Short) As DataTable
    Dim table As DataTable = adapter.GetData 'entire table
    'filter to get desired row(s)
    table.DefaultView.RowFilter = " ID = " & custid
    Return table
End Function
End Class

带有datagridview和无线电按钮代码的显示窗口表单是:

' For the datagridview, display only first name, last name, fulltime, hiredate and salary
' If you do not want to display the column, use the visible property.
' For example, SalesDataGridView.Columns(0).Visible = false
' To accumulate the total salary, you can use the cells in the datagridview
' For example, id is in cells(0).
Public Class frmDisplay
Private aCustomers As New Customers
Private formLoading As Boolean = True
Private Sub radFT_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub
Private Sub radPT_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    SalesDataGridView.DataSource = aCustomers.Items
End Sub

End Class
  1. 弄清楚如何仅显示全职客户。
  2. 弄清楚如何仅显示兼职客户。步骤1之后,这将很容易。
  3. 当广播按钮更改时,请重新加载适当的数据(您在步骤1和2中所做的事情)。您可以在签到的事件中处理此操作。

最新更新