VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
[Help] How to associate a timer to my function.. ? Posted by metagoth on 8 Mar 2012 at 2:37 AM
I am facing another issue. I want to associate a timer to my function. Actually what i am doing is that i am tryin to store certain values in a database. A function is such that it calculates 5 values and stores them in a database. While storing them in the database it displays them in a textbox on the form. Now i want to display them one by one which it does. But it does it so fast that i can only see the last value that it enters in the database inside the textbox.

Can i make it show all the values slowly one by one.

Can anybody suggest me how to do so. I googled a lot but could find a particular answer.
thnx in advance friends..
Sub CreateHash()
HashCalcProgressBar.Minimum = 0
HashCalcProgressBar.Maximum = 100
HashCalcProgressBar.Value = 0
Dim fileMD5 As String
Dim i As Integer
fileToHash(0) = "C:\Windows\system32\services.exe"
fileToHash(1) = "C:\Windows\system32\lsass.exe"
fileToHash(2) = "C:\Windows\system32\svchost.exe"
fileToHash(3) = "C:\Windows\system32\alg.exe"
fileToHash(4) = "C:\Windows\system32\winlogon.exe"
For i = 0 To 4
If HashCalcProgressBar.Value < 100 Then
If My.Computer.FileSystem.FileExists(fileToHash(i)) Then
'MsgBox("The File " + fileToHash(i) + " found in System Folder")
fileMD5 = GenerateFileMD5(fileToHash(i))
'MsgBox(fileMD5)
dbInsert(fileMD5, fileToHash(i), i)
HashCalcProgressBar.Value += 20
Else
MsgBox("File Not Found")
End If
End If
Next
i = i + 1
End Sub

Private Sub dbInsert(ByVal strfile As String, ByVal hashoffile As String, ByVal p As Integer)
'parameter to the above function (ByVal strfile As String)

DbConnection()
cmd = "select * from hashtable"
da = New OleDb.OleDbDataAdapter(cmd, con)
da.Fill(ds, "values")
maxrows = ds.Tables("values").Rows.Count
TextBox1.Text = p + 1
TextBox2.Text = hashoffile
TextBox3.Text = strfile
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsnewrow As DataRow
dsnewrow = ds.Tables("values").NewRow()
dsnewrow.Item("p_id") = TextBox1.Text
dsnewrow.Item("process_name") = TextBox2.Text
dsnewrow.Item("hash_value") = TextBox3.Text
ds.Tables("values").Rows().Add(dsnewrow)
da.Fill(ds)
da.Update(ds, "values")
con.Close()
End Sub




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.