Ramta,
I made a sample with a timer for this guestion a while ago.
However I made a new one, this one shows it maybe nicer.
(Although I changed the old one in a very lazy way)
\\\Needs A form with a listbox and this code
Private myQ As New Queue
Private myreadDb1 As New readData(myQ, 1)
Private myreadDb2 As New readData(myQ, 2)
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyThr1 As New System.Threading.Thread(AddressOf myreadDb1.Read)
AddHandler myreadDb1.IgotIt, AddressOf Me.myreadDb_IgotIt
MyThr1.Start()
Dim MyThr2 As New System.Threading.Thread(AddressOf myreadDb2.Read)
MyThr2.Start()
AddHandler myreadDb2.IgotIt, AddressOf Me.myreadDb_IgotIt
End Sub
Private Sub myreadDb_IgotIt()
Do Until myQ.Count = 0
SyncLock myQ.SyncRoot
If myQ.Count > 0 Then
Me.ListBox1.Items.Add(myQ.Dequeue)
Me.ListBox1.SelectedIndex = ListBox1.Items.Count - 1
Me.ListBox1.Show()
End If
End SyncLock
Loop
End Sub
End Class
////
\\\
Public Class readData
Private MyQ As Queue
Private Int As Integer
Public Event IgotIt()
Public Sub New(ByVal pMyQ As Queue, ByVal MInt As Integer)
MyQ = pMyQ
Int = MInt
End Sub
Friend Sub Read()
For i As Integer = 65 To 90
SyncLock MyQ.SyncRoot
If Int = 1 Then
MyQ.Enqueue(i - 65)
Else
MyQ.Enqueue(ChrW(i))
End If
End SyncLock
Threading.Thread.Sleep(CInt(i * Int * 10))
RaiseEvent IgotIt()
Next
End Sub
End Class
///
I hope this helps a little bit?
Cor