Click here to Skip to main content
15,887,027 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to create a custom deployment project? Pin
tcombs0714-May-07 15:38
tcombs0714-May-07 15:38 
AnswerRe: How to create a custom deployment project? Pin
Dave Kreskowiak14-May-07 16:40
mveDave Kreskowiak14-May-07 16:40 
QuestionHow can I get the Microsoft SDK 5.1 Speech Engine to read the current line of text the cursor is on? Pin
josh047614-May-07 14:30
josh047614-May-07 14:30 
AnswerRe: How can I get the Microsoft SDK 5.1 Speech Engine to read the current line of text the cursor is on? Pin
Dave Kreskowiak14-May-07 16:38
mveDave Kreskowiak14-May-07 16:38 
QuestionArray to Datagrid back to array Pin
GregRH14-May-07 10:18
GregRH14-May-07 10:18 
AnswerRe: Array to Datagrid back to array Pin
Dave Kreskowiak15-May-07 3:35
mveDave Kreskowiak15-May-07 3:35 
GeneralRe: Array to Datagrid back to array Pin
GregRH15-May-07 4:28
GregRH15-May-07 4:28 
QuestionNeed help with my service please!!! Pin
tcombs0714-May-07 9:40
tcombs0714-May-07 9:40 
Hey guys the problem that I am is this. I am writting a service that every five minutes goes out and requests a web page. And the problem that I am having is whenever I disconnect my computer for the internet, the service throws an error. I have tried implementing some error handling but I can't seem to figure it out. I would like to code somethingso that if in 30 seconds a response is not gathered then to abort the request and try again in five minutes. Here is the code that i currently have:

Imports System
Imports System.IO
Imports System.Net
Imports System.Threading

Public Class VirasecHB

'Declare the Thread
Private VirasecHB_Thread As New Thread( _
New System.Threading.ThreadStart(AddressOf waitProcedure))

'Declare Variables
Dim serverID As String = "1336"
Dim webURL As String = "http://www.virasec.com/intranet/tech/heart/heartdb.asp?hdur=300&hsid=" & serverID


Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.

WebRequestProcedure()
VirasecHB_Thread.Start()
End Sub

Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
VirasecHB_Thread.Abort()
End Sub

Private Sub WebRequestProcedure()
' Create a request for the URL.
Dim request As WebRequest = WebRequest.Create(webURL)
' If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials
'Sets web request timeout time
request.Timeout = 30000 ' 30000 = 30 Seconds
' Get the response.
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
'Close the response request
response.Close()
End Sub

Private Sub waitProcedure()
Do
'Wait Five Mintues
System.Threading.Thread.Sleep(300000) '300000 = 5 Minutes

Try
WebRequestProcedure()
Catch ex As Exception

Dim errorLog As New EventLog

errorLog.WriteEntry("Virasec Heartbeat Service " & _
"has encountered an error while trying to " & _
"connect to the Virasec web server. " & _
"The service will attempt to " & _
"connect again in five minutes.", EventLogEntryType.Error)
End Try
Loop
End Sub
End Class


If there is anything you guys can do to help please let me know.

Thanks again,
Travis


AnswerRe: Need help with my service please!!! Pin
Paul Conrad14-May-07 9:45
professionalPaul Conrad14-May-07 9:45 
AnswerRe: Need help with my service please!!! Pin
SimulationofSai14-May-07 9:52
SimulationofSai14-May-07 9:52 
AnswerRe: Need help with my service please!!! Pin
Dave Kreskowiak14-May-07 9:59
mveDave Kreskowiak14-May-07 9:59 
QuestionSelectedIndexChanged click item listbox database Pin
keninfo14-May-07 9:34
keninfo14-May-07 9:34 
AnswerJust a friendly reminder... Pin
Dave Kreskowiak14-May-07 9:01
mveDave Kreskowiak14-May-07 9:01 
JokeRe: Just a friendly reminder... Pin
Paul Conrad14-May-07 9:14
professionalPaul Conrad14-May-07 9:14 
GeneralRe: Just a friendly reminder... Pin
Dave Kreskowiak14-May-07 9:47
mveDave Kreskowiak14-May-07 9:47 
GeneralRe: Just a friendly reminder... Pin
Paul Conrad14-May-07 9:53
professionalPaul Conrad14-May-07 9:53 
QuestionHow to filter data readed from code bar reader to datagrid Pin
Mr. Wonderful14-May-07 8:14
Mr. Wonderful14-May-07 8:14 
AnswerRe: How to filter data readed from code bar reader to datagrid Pin
Dave Kreskowiak14-May-07 8:50
mveDave Kreskowiak14-May-07 8:50 
GeneralRe: How to filter data readed from code bar reader to datagrid Pin
Mr. Wonderful15-May-07 7:09
Mr. Wonderful15-May-07 7:09 
QuestionHow to see CPU use (%) Pin
Zaegra14-May-07 8:12
Zaegra14-May-07 8:12 
AnswerRe: How to see CPU use (%) Pin
MatrixCoder14-May-07 8:23
MatrixCoder14-May-07 8:23 
GeneralRe: How to see CPU use (%) [modified] Pin
Dave Kreskowiak14-May-07 8:40
mveDave Kreskowiak14-May-07 8:40 
GeneralRe: How to see CPU use (%) Pin
Paul Conrad14-May-07 8:53
professionalPaul Conrad14-May-07 8:53 
GeneralRe: How to see CPU use (%) Pin
Zaegra15-May-07 3:14
Zaegra15-May-07 3:14 
AnswerRe: How to see CPU use (%) Pin
Dave Kreskowiak14-May-07 8:44
mveDave Kreskowiak14-May-07 8:44 

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.