Click here to Skip to main content
15,896,063 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: set Windowstate Pin
Dave Kreskowiak8-Jan-09 1:57
mveDave Kreskowiak8-Jan-09 1:57 
QuestionHow to read datas from USB ??? Pin
JC.KaNNaN7-Jan-09 23:15
JC.KaNNaN7-Jan-09 23:15 
AnswerRe: How to read datas from USB ??? Pin
Dave Kreskowiak8-Jan-09 1:55
mveDave Kreskowiak8-Jan-09 1:55 
Questionis there a way to query print copies Pin
vbbeg7-Jan-09 19:04
vbbeg7-Jan-09 19:04 
AnswerRe: is there a way to query print copies Pin
Guffa7-Jan-09 20:46
Guffa7-Jan-09 20:46 
GeneralRe: is there a way to query print copies Pin
vbbeg7-Jan-09 20:50
vbbeg7-Jan-09 20:50 
AnswerRe: is there a way to query print copies Pin
Duncan Edwards Jones8-Jan-09 3:11
professionalDuncan Edwards Jones8-Jan-09 3:11 
QuestionProblem with running a windows service in vb.net Pin
sohaib_a7-Jan-09 7:55
sohaib_a7-Jan-09 7:55 
I have a windows a service that periodically checks the tcp/ip connection of device by pinging it and returning the status.

So for this i have used a timer.At first i tried to to dynamically create a timer using System.Timers.Timer and using the 'Elapsed'event.But the when i tried to start the service it wouldn't start.

Then I used a timer from the toolbox and seemed to start fine,the code in onstop and onstart subs is executing.However the code in timer_tick event isn't.I don't know why.I start the timer in the onstart and stop it onstop.

Below is code for the timer event.

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick



        Dim api As New RfidApiLib.RfidApi
        Dim status1 As Integer

        Dim StrCon As String
        Dim conn As SqlConnection
        Dim host As String
        'Dim status1 As Integer
        test.WriteByDate("e:\temp", "log", "service", "reader timer this connected") ' Writes to log file
        'mylog.WriteEntry("Connected", EventLogEntryType.Information)

        StrCon = "data source=XXX;initial catalog=XXX; uid=XXX; pwd=XXX;"
        conn = New SqlConnection(StrCon)

        conn.Open()

        Dim outadapter1 As New SqlDataAdapter("select * from dbo.ReaderInfo where dbo.ReaderInfo.Reader_location in (Select Reader_location from dbo.Reader_Status )", conn)
        Dim ds1 As New DataSet()
        outadapter1.Fill(ds1, "dbo.ReaderInfo")

        Dim outadapter2 As New SqlDataAdapter("Select * from dbo.Reader_Status where Remarks = 'C'", conn)
        Dim ds2 As New DataSet()
        outadapter1.Fill(ds2, "dbo.ReaderInfo")

        For i As Integer = 0 To ds2.Tables(0).Rows.Count - 1

            host = ds1.Tables(0).Rows(i)("ReaderIP").ToString
            Try
                'My.Computer.Network.Ping(host)
                Dim ping As New System.Net.NetworkInformation.Ping()
                Dim pingReply As System.Net.NetworkInformation.PingReply = ping.Send(host) 'ping ipaddress

                'test.WriteByDate("e:\temp", "log", "service", "reader" & ds1.Tables(0).Rows(i)("Reader_location").ToString & "disconnected" & e1.Message)

            Catch e1 As System.Net.NetworkInformation.PingException 'if not connected try reconnecting

                status1 = api.TcpConnectReader(ds1.Tables(0).Rows(i)("ReaderIP").ToString, ds1.Tables(0).Rows(i)("ReaderPort")) 'API call to connect to device

                If status1 = 0 Then ' successfully connected
                    Exit For

                Else
                    test.WriteByDate("e:\temp", "log", "service", "reader" & ds1.Tables(0).Rows(i)("Reader_location").ToString & "disconnected" & e1.Message) 'otherwise write to log
                    GoTo nxt
                End If



            End Try

nxt:    Next

End Sub
        conn.Close()

AnswerRe: Problem with running a windows service in vb.net [modified] Pin
Dave Kreskowiak7-Jan-09 8:13
mveDave Kreskowiak7-Jan-09 8:13 
AnswerRe: Problem with running a windows service in vb.net Pin
programmervb.netc++7-Jan-09 9:26
programmervb.netc++7-Jan-09 9:26 
AnswerRe: Problem with running a windows service in vb.net Pin
Tim Carmichael7-Jan-09 10:06
Tim Carmichael7-Jan-09 10:06 
GeneralRe: Problem with running a windows service in vb.net Pin
sohaib_a7-Jan-09 23:58
sohaib_a7-Jan-09 23:58 
Questionform.Show(IWin32Window) vs form.owner as windows.forms.form Pin
|_josh_|7-Jan-09 6:57
|_josh_|7-Jan-09 6:57 
AnswerRe: form.Show(IWin32Window) vs form.owner as windows.forms.form Pin
Jon_Boy7-Jan-09 7:30
Jon_Boy7-Jan-09 7:30 
GeneralRe: form.Show(IWin32Window) vs form.owner as windows.forms.form Pin
|_josh_|7-Jan-09 9:07
|_josh_|7-Jan-09 9:07 
AnswerRe: form.Show(IWin32Window) vs form.owner as windows.forms.form Pin
Dave Kreskowiak7-Jan-09 8:11
mveDave Kreskowiak7-Jan-09 8:11 
AnswerRe: form.Show(IWin32Window) vs form.owner as windows.forms.form Pin
|_josh_|7-Jan-09 12:44
|_josh_|7-Jan-09 12:44 
GeneralRe: form.Show(IWin32Window) vs form.owner as windows.forms.form Pin
Arthur Milfait10-Feb-09 5:43
Arthur Milfait10-Feb-09 5:43 
QuestionDynamically remove multiple innstances of child form from parent form Pin
sohaib_a7-Jan-09 6:43
sohaib_a7-Jan-09 6:43 
AnswerRe: Dynamically remove multiple innstances of child form from parent form Pin
EliottA7-Jan-09 6:54
EliottA7-Jan-09 6:54 
GeneralRe: Dynamically remove multiple innstances of child form from parent form Pin
sohaib_a7-Jan-09 7:21
sohaib_a7-Jan-09 7:21 
QuestionForce a Tab Pin
Cory Kimble7-Jan-09 4:34
Cory Kimble7-Jan-09 4:34 
AnswerRe: Force a Tab Pin
Wendelius7-Jan-09 4:52
mentorWendelius7-Jan-09 4:52 
GeneralRe: Force a Tab Pin
Cory Kimble7-Jan-09 5:48
Cory Kimble7-Jan-09 5:48 
GeneralRe: Force a Tab Pin
Wendelius7-Jan-09 6:07
mentorWendelius7-Jan-09 6:07 

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.