Thinker

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Thinker

Forum for story


    【Filter控件设置】-筛选功能Filter

    Aueeins
    Aueeins
    呢喃的歌声


    帖子数 : 205
    积分 : 5229
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    【Filter控件设置】-筛选功能Filter Empty 【Filter控件设置】-筛选功能Filter

    Post by Aueeins 2011-09-23, 11:26 am

    Private Sub btnFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilter.Click
    If btnFilter.Enabled = False Then Exit Sub
    Try
    Dim strSqlFilter As String
    Dim f09AssetFilter As New f09AssetFilter
    f09AssetFilter.ShowDialog()

    If vpError = False Then
    With Me
    strSqlFilter = vSqlHeaderStr & f09AssetFilter.v09AssetFilterStr & " ORDER BY AssetNo "
    vDs09Asset = cls00Connection.getDataSet(strSqlFilter, vpConnStr)
    dgv09Asset.AutoGenerateColumns = False
    dgv09Asset.DataSource = vDs09Asset.Tables(0)
    End With
    Call pClearDataBinding()
    Call pDataBinding()
    Call pRecordCount()
    End If
    f09AssetFilter.Close()
    f09AssetFilter.Dispose()
    If dgv09Asset.Enabled Then dgv09Asset.Select()
    Catch ex As Exception
    MsgBox("<f09Asset.btnFilter_Click> " & ex.Message)
    End Try
    End Sub

    =====================
    'WRITE BY [CHENGWENKAI]
    Imports ZLibrary
    Public Class f09AssetFilter
    Public v09AssetFilterStr As String

    Private Sub f09AssetFilter_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    Select Case e.KeyCode
    Case Keys.F5 : Call btnFilter_Click(sender, e)
    Case Keys.Return : System.Windows.Forms.SendKeys.Send("{TAB}")
    Case Keys.Q : Call btnExit_Click(sender, e)
    Case Keys.Escape
    Call btnExit_Click(sender, e)
    End Select
    End Sub

    Private Sub f09AssetFilter_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    v09AssetFilterStr = ""
    End Sub

    Private Sub btnFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilter.Click
    Try
    v09AssetFilterStr = ""
    If txtAssetId.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and AssetNo like '" & cls00Regional.String_Filter(txtAssetId.Text) & "%' "
    End If

    If txtAssetCode.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and AssetCode like '%" & cls00Regional.String_Filter(txtAssetCode.Text) & "%' "
    End If

    If txtAssetSN.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and AssetRegNo like '%" & cls00Regional.String_Filter(txtAssetSN.Text) & "%' "
    End If

    If txtAssetGrp.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and AssetGrp like '" & cls00Regional.String_Filter(txtAssetGrp.Text) & "%' "
    End If

    If txtMake.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and Make like '" & cls00Regional.String_Filter(txtMake.Text) & "%' "
    End If

    If txtModel.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and Model like '" & cls00Regional.String_Filter(txtModel.Text) & "%' "
    End If

    If txtAssetClass.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and AssetClass like '" & cls00Regional.String_Filter(txtAssetClass.Text) & "%' "
    End If

    If txtCapacityFrom.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and Capacity >= '" & cls00Regional.String_Filter(txtCapacityFrom.Text) & "' "
    End If

    If txtCapacityTo.Text <> "" Then
    v09AssetFilterStr = v09AssetFilterStr & " and Capacity <= '" & cls00Regional.String_Filter(txtCapacityTo.Text) & "' "
    End If

    If v09AssetFilterStr = "" Then MsgBox("You DID NOT SELECT any filter options!") : txtAssetId.Select() : Exit Sub
    vpError = False
    Me.Hide()
    Catch ex As Exception
    MsgBox("<f09AssetFilter.btnFilter_Click> " & ex.Message)
    End Try
    End Sub

    Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
    txtAssetId.Text = ""
    txtAssetCode.Text = ""
    txtAssetSN.Text = ""
    txtAssetGrp.Text = ""
    txtMake.Text = ""
    txtModel.Text = ""
    txtAssetClass.Text = ""
    txtCapacityFrom.Text = ""
    txtCapacityTo.Text = ""
    txtAssetId.Select()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    v09AssetFilterStr = ""
    vpError = True
    Me.Hide()
    End Sub

    Private Sub txtAssetId_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAssetId.GotFocus
    Call txtAssetId.SelectAll()
    End Sub

    Private Sub txtAssetCode_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAssetCode.GotFocus
    Call txtAssetCode.SelectAll()
    End Sub

    Private Sub txtAssetSN_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAssetSN.GotFocus
    Call txtAssetSN.SelectAll()
    End Sub

    Private Sub txtAssetGrp_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAssetGrp.GotFocus
    Call txtAssetGrp.SelectAll()
    End Sub

    Private Sub txtMake_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMake.GotFocus
    Call txtMake.SelectAll()
    End Sub

    Private Sub txtModel_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtModel.GotFocus
    Call txtModel.SelectAll()
    End Sub

    Private Sub txtAssetClass_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAssetClass.GotFocus
    Call txtAssetClass.SelectAll()
    End Sub

    Private Sub txtCapacityFrom_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCapacityFrom.GotFocus
    Call txtCapacityFrom.SelectAll()
    End Sub

    Private Sub txtCapacityTo_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCapacityTo.GotFocus
    Call txtCapacityTo.SelectAll()
    End Sub
    End Class
    Aueeins
    Aueeins
    呢喃的歌声


    帖子数 : 205
    积分 : 5229
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    【Filter控件设置】-筛选功能Filter Empty Re: 【Filter控件设置】-筛选功能Filter

    Post by Aueeins 2011-09-23, 11:27 am

    模糊查询,精确查询

      Current date/time is 2024-11-25, 4:30 pm