Hello,
I have used following code, it works for one time. As I want loop to work for 4 times. The code should dial number and show dialing status in Listbox. It do this for one time only. When It loop for second time, it do not show any dialing status in Listbox though dialing code executes(I saw thisin debug section).
Please me out to solve this.
I have used following code, it works for one time. As I want loop to work for 4 times. The code should dial number and show dialing status in Listbox. It do this for one time only. When It loop for second time, it do not show any dialing status in Listbox though dialing code executes(I saw thisin debug section).
VB.NET:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim th1 As New Threading.Thread(AddressOf Dialsub)
th1.IsBackground = True
th1.Start()
End Sub
Private Sub Dialsub()
For i As Integer = 0 To 4
sw.Start()
System.Threading.Thread.Sleep(5000)
sw.Stop()
Dim tm As TimeSpan
tm = sw.Elapsed
'MsgBox(tm.Seconds)
If tm.Seconds = 4 Or tm.Seconds = 9 Then
' Dim rasconnection1 As New Ras.RasConnection
RasConnection1.PhoneNumber = "#777"
RasConnection1.UserName = "vwireless@ptcl.com"
RasConnection1.Password = "ptcl"
RasConnection1.Dial()
End If
Button9.Text = i
Next
End Sub
Private Sub RasConnection1_DialNotify1(ByVal sender As Object, ByVal e As Ras.RasDialNotify1EventArgs) Handles RasConnection1.DialNotify1
ListBox1.Items.Add(String.Format("{0}", e.ConnectionState, e.Message.ToString))
If e.[Error] > 0 Then
MessageBox.Show(String.Format("{0},{1}", e.[Error], e.Message))
End If
' RasConnection1.Dispose()
End Sub
Please me out to solve this.