如何为datagridview列创建基本的过滤工具

时间:2019-06-16 09:36:07

标签: visual-studio

我有一列名为“类型”的列,试图通过动作,浪漫,幻想和恐怖等类型对其进行过滤。

我尝试了许多解决方案来查找过滤器方法,但结果是所有c#以及旧版本v.s

    Imports System.Data.SqlClient
Public Class Form1
Private ConnectionString As String = GetConnectinString()
Private Connection As New SqlConnection(ConnectionString)
Private adapter As SqlDataAdapter
Private datast As DataSet
Private sql As String
Private app As String
Dim dbdataset As New DataTable
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'IMDbDataSet11.table3' table. You can move, or remove it, as needed.
    Me.Table3TableAdapter.Fill(Me.IMDbDataSet11.table3)
    ComboBox1.SelectedIndex = 0
    OpenSQLConnection()

End Sub

Private Function GetConnectinString() As String
    Return "Data source=DESKTOP-52R55AK\SQLEXPRESS01;Initial Catalog=IMDb;" &
        "Integrated Security=True; MultipleActiveResultSets=True"
End Function
'DESKTOP-52R55AK\SQLEXPRESS01

Private Sub OpenSQLConnection()
    Connection.Open()
    With Connection
        If .State = ConnectionState.Open Then
            TextBox1.Text = "Open"
        Else
            TextBox1.Text = "Closed"
        End If

        TextBox1.Text = .ServerVersion
        TextBox3.Text = .Database
        TextBox4.Text = .DataSource
        TextBox5.Text = .ConnectionString

    End With
End Sub

Private Function IsFieldSorted() As Boolean
    If ComboBox1.SelectedIndex = 0 Then
        Return True
    Else
        Return False
    End If
End Function

0 个答案:

没有答案