Display Data on form when timer control is running

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benniit
    New Member
    • May 2008
    • 54

    #1

    Display Data on form when timer control is running

    I need help. My problem is I'm using visual basic.net 2008 and SQL server 2008. Now, the result the function below returns is the total number of records in the DataGridView based on the SQL query.
    My problem now is, I want the value of frmBlinker.lblM essage.Text &= Table.Rows.Coun t.ToString.Trim & " file(s) to receive."
    should get displayed as a notification to a user time to time. The problem is when I give the value of frmBlinker.lblM essage.Text &= Table.Rows.Coun t.ToString.Trim & " file(s) to receive." to a timer control so that it checks whether
    new files have been sent to the user, the form on which the total no. of files get disoplayed, freezees as a result of the timer control that keeps track of the records in the database if new record has been sent to the user. How do I please dispaly the result on the form while the timer is running and does not freeze the form, users do data entry on that form?

    Thanks in advance.
    Code:
    Public Function TrackMovementOfFiles() As String
            strUsername = GetSetting("Lands", "Connection", "DataL1")
            strPassword = GetSetting("Lands", "Connection", "DataL2")
            strServerName = GetSetting("Lands", "Connection", "DataL3")
            strInitialCatalog = GetSetting("Lands", "Connection", "DataL4")
            DataL1 = strUsername & strPassword & "Connect Timeout=0; " & strServerName & strInitialCatalog
            Dim strQuery As String = "Select * from File_Movement where Movement_To='" & frmHome.txtUserName.Text.Trim & "' and Movement_Status='" & "Not Receipted" & "' and fdate > '2010-1-30' order by FDate desc, Ftime desc"
            SQLCon = New SqlConnection(DataL1)
            dTable = New DataSet
            daAdapter = New SqlDataAdapter(strQuery, SQLCon)
            daAdapter.Fill(dTable, "File_Movement")
            Dim Table As DataTable = dTable.Tables("File_Movement")
            If Table.Rows.Count > 0 Then
                frmBlinker.lblMessage.Text = ""
                frmBlinker.lblMessage.Text = "You have "
                frmBlinker.lblMessage.Text &= Table.Rows.Count.ToString.Trim & " file(s) to receive."
                Return Blinker.lblMessage.Text.ToString
            End If
            Return Nothing
    End Function
    Last edited by Frinavale; May 6 '10, 01:45 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
Working...