Click here to Skip to main content
15,916,600 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB help please! Pin
Colin Angus Mackay9-May-09 13:22
Colin Angus Mackay9-May-09 13:22 
GeneralRe: VB help please! Pin
EliottA11-May-09 2:51
EliottA11-May-09 2:51 
QuestionDeleting Coresponding Row(s) Pin
JustinRiggs9-May-09 9:49
JustinRiggs9-May-09 9:49 
AnswerRe: Deleting Coresponding Row(s) Pin
Henry Minute9-May-09 10:05
Henry Minute9-May-09 10:05 
GeneralRe: Deleting Coresponding Row(s) Pin
JustinRiggs9-May-09 10:26
JustinRiggs9-May-09 10:26 
GeneralRe: Deleting Coresponding Row(s) Pin
Noctris10-May-09 12:23
Noctris10-May-09 12:23 
AnswerRe: Deleting Coresponding Row(s) Pin
JustinRiggs9-May-09 12:49
JustinRiggs9-May-09 12:49 
QuestionThreading Problem Pin
DarkSorrow389-May-09 5:44
DarkSorrow389-May-09 5:44 
The code to create thread at the service start event.
Dim SerialPort1 As New SerialPort
Dim returnstr As String = ""
Dim thread1 As New Thread(AddressOf RecieveSerialData)

If thread1.IsAlive = False Then
thread1.Start()
thread1.Priority = ThreadPriority.Highest
End If
If thread1.IsBackground = False Then 'I am getting an exception in this statement stating the thread is dead.
thread1.IsBackground = True
End If

Public Sub RecieveSerialData()
Try
Using SerialPort1 As IO.Ports.SerialPort= My.Computer.Ports.OpenSerialPort(b)
MessageBox.Show("The " & b & " port is now opened.")
Do
Dim incomming As String = SerialPort1.ReadLine(b)
If incomming Then
MessageBox.Show(Now.ToString)
End If
Loop
End Using
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error",MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub

The code stop the service and thread :

If thread1.IsAlive = True Then
thread1.Abort()
End If
If SerialPort1.IsOpen = True Then
SerialPort1.Close()
Else
MessageBox.Show("The service is already stoped.", "Serial Service", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub

Here I am getting various exception like
(1) The process cannot access COM3 port because it is being used by another process. This exception occurs when the first time service is activated. In the first attempt the stop service procedure executes properly.
(2) After the first execution the IsBackground statement gives an exception stating the thread id dead.

GeneralRe: Threading Problem Pin
harold aptroot9-May-09 6:13
harold aptroot9-May-09 6:13 
QuestiongetData from xml with VB.NET Pin
woerny9-May-09 4:09
woerny9-May-09 4:09 
AnswerRe: getData from xml with VB.NET Pin
Zaegra9-May-09 4:43
Zaegra9-May-09 4:43 
Questioncreate and run process with link (vb.net2005) Pin
hrishiS9-May-09 2:42
hrishiS9-May-09 2:42 
AnswerRe: create and run process with link (vb.net2005) Pin
Luc Pattyn9-May-09 3:06
sitebuilderLuc Pattyn9-May-09 3:06 
GeneralRe: create and run process with link (vb.net2005) Pin
hrishiS9-May-09 3:10
hrishiS9-May-09 3:10 
GeneralRe: create and run process with link (vb.net2005) Pin
Zaegra9-May-09 4:33
Zaegra9-May-09 4:33 
AnswerRe: create and run process with link (vb.net2005) Pin
Dave Kreskowiak9-May-09 7:19
mveDave Kreskowiak9-May-09 7:19 
Questionproblem related to textbox Pin
nazimghori9-May-09 2:24
nazimghori9-May-09 2:24 
AnswerRe: problem related to textbox Pin
Zaegra9-May-09 4:00
Zaegra9-May-09 4:00 
GeneralRe: problem related to textbox Pin
nazimghori9-May-09 4:13
nazimghori9-May-09 4:13 
QuestionRe: problem related to textbox Pin
nazimghori9-May-09 4:19
nazimghori9-May-09 4:19 
GeneralRe: problem related to textbox [modified] Pin
Zaegra9-May-09 4:30
Zaegra9-May-09 4:30 
Questionwhat is the purpose? Pin
Willington9-May-09 1:57
Willington9-May-09 1:57 
AnswerRe: what is the purpose? Pin
Dave Kreskowiak9-May-09 7:17
mveDave Kreskowiak9-May-09 7:17 
QuestionHelp Needed Pin
DarkSorrow388-May-09 7:58
DarkSorrow388-May-09 7:58 
AnswerRe: Help Needed Pin
Dave Kreskowiak8-May-09 8:58
mveDave Kreskowiak8-May-09 8:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.