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). -
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.
3 2064
Plz check the statement tm.Seconds = 4. It shall be 5sec because, you waited 5000ms=5sec at the statement System.Threading.Thread.Sleep(5000). Do check the if tm.Seconds statement once again.Plz post your code segments in the [code] blocks(Just click # on your right top of the thread editor window.), which gives easy look at your code, thus can improve the response time.
@Ramk
Thanks RAMK for ur response... - 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
Well, I found the cause that is, when RasConnection1.Dial() executes, it get error, on next attempt it do not dial connection instead internally a error is raised that "Connection already being used", something like that. I tried rasconnection.dispose to dispose this control. But It do not dispose.
What should I do to dispose this RAS control? Is there any strong feature in VB.NET that dispose all threads of any control?
Thanks
I tried rasconnection.dispose to dispose this control. But It do not dispose.
What should I do to dispose this RAS control? Is there any strong feature in VB.NET that dispose all threads of any control?
Thanks
How you are saying it is not disposed? I wouldn't understand. Try to use close method instead if such method exists. If you are having multiple threads, try to check the ThreadPool class can help you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Harry |
last post by:
Using Oracle 8i enterprise on win 2000 (sp3)
Installed the standard configuration & whenever I make a connection it
takes about 10 secs. It's running on a P1900 with 1gb Ram so no reason
there...
|
by: James |
last post by:
We've had a recurring problem where all of a sudden we get a DBMSSOCN
General Network Error on any page that connects to SQL Server. Then we have
to reboot the server and everything works fine...
|
by: Mark |
last post by:
I know that DB2 LUW version 8 has "connection pooling" that provides a
connection concentrator (limits the number of simultaneous connections
that can occur). But does it really provide connection...
|
by: Eric Sabine |
last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET
connection object, SQLConnection to be exact) and then I came across the
following in some microsoft code.
If Not cn Is Nothing...
|
by: Rahul Anand |
last post by:
Getting SQL Exception when trying to implement Connection
based Trasaction using SQL Helper class.
I am using the follwing function to execute my stored
procs:
-=-=-=-
ExecuteScalar(ByVal...
|
by: Suresh |
last post by:
Hi Guys
I have Db2 server installed on remote server. i am connecting to that
remote server by using VPN.
I want to connect that remote DB2 server instance using my local
machine DB2...
|
by: crbd98 |
last post by:
Hello All,
Some time ago, I implemented a data access layer that included a simple
connectin pool. At the time, I did it all by myself: I created N
connections, each connection associated with...
|
by: fniles |
last post by:
I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I use
the exact matching connection string),
1. how can I know how...
|
by: sherifbk |
last post by:
Problem description
==============
- I have 4 clients and 1 server (SQL server)
- 3 clients are Monitoring console 1 client is operation console
- Monitoring console collects some data from...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |