using a for loop i want to be able to pause it, display string in text box for 60 seconds then move to the next loop,change content of the string and display it again for 60 seconds.this should go on till end of count.i am currently using a timer in do while loop to pause, but instead of displaying the string contents in each loop,it adds up all contents in all the loops and displays them at the end of count,not what i want. i tried using 'sleep' funtion but its behaving the same.below is the code:
For i = 1 To count Step 3 'empty string disall = "" less = count - cnt If less < 0 Then less = 0 End If If sex = "m" Then myCmd1 = New SqlCommand("select top 3 * from (select row_number() over(order by Age) as RowNumber,Tel,Name,Age,Sex,Town,Description from members where Town='" & town & "') as myResults where RowNumber>'" & counter & "' and Sex='f' and Town ='" & town & "' and Age >= '" & age1 & "' and Age <= '" & age2 & "'", myCon) Else myCmd1 = New SqlCommand("select top 3 * from (select row_number() over(order by Age) as RowNumber,Tel,Name,Age,Sex,Town,Description from members where Sex='m') as myResults where RowNumber>'" & counter & "' and Sex='m' and Town ='" & town & "' and Age >= '" & age1 & "' and Age <= '" & age2 & "'", myCon) End If myadap.SelectCommand = myCmd1 myadap.Fill(ds) dv = New DataView(ds.Tables(0)) DataGridView1.DataSource = dv dr = myCmd1.ExecuteReader While dr.Read dis1 = (dr(1).ToString()) dis2 = (dr(2).ToString()) dis3 = (dr(3).ToString()) dis4 = (dr(5).ToString()) disall += dis2 & " aged " & dis3 & " " & dis1 & "," 'assign contents to string,which will be different in the next for loop strall = disall & ".Send NEXT to 5001 to receive details of the remaining " & less & " ladies" 'TextSend.Text = strall End While counter += 3 count = count - 3 dr.Close() Dim Start, Finish As Double Start = Microsoft.VisualBasic.DateAndTime.Timer Finish = Start + 60.0 ' Set end time for 60-second duration. Do While Microsoft.VisualBasic.DateAndTime.Timer < Finish 'display string contents which should be different in the next for loop TextSend.Text = strall Loop 'Threading.Thread.Sleep(10000) Next
any ideas,will be appreciated.