Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Vb.Net App does not allow system to log off when running

Vb.Net App does not allow system to log off when running

Scheduled Pinned Locked Moved Visual Basic
csharphtmlquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thedom2
    wrote on last edited by
    #1

    Hi All As my subject suggest i have a vb.net Application. Whilst its running does not allow my computer to logoff. I have tried this on two other machines to no avail. Any suggestions. ?? I didnt include code because I don't think its necessary . Cheers Dom

    C 1 Reply Last reply
    0
    • T thedom2

      Hi All As my subject suggest i have a vb.net Application. Whilst its running does not allow my computer to logoff. I have tried this on two other machines to no avail. Any suggestions. ?? I didnt include code because I don't think its necessary . Cheers Dom

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Windows would prefer all applications to end cleanly when it shuts down. It therefore waits until they do so. But after a while it should pop up a dialog asking if you want to "End Now" which forces the application to close. The application is obviously not responding to the shutdown event. This could be because it is performing an extended operaration without responding to events. Why type of application is this?


      Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

      T 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Windows would prefer all applications to end cleanly when it shuts down. It therefore waits until they do so. But after a while it should pop up a dialog asking if you want to "End Now" which forces the application to close. The application is obviously not responding to the shutdown event. This could be because it is performing an extended operaration without responding to events. Why type of application is this?


        Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

        T Offline
        T Offline
        thedom2
        wrote on last edited by
        #3

        Hi Colin thats what I thought so something must be wrong. Its a windows app. Its starts off with a form starting at runtime named Hidden here is the code that triggers at load Private Sub Hidden_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load xSock.UDP_Listen(10080) AddHandler xSock.DataArrival, AddressOf UDPArrival End Sub in the above code it calls a class method as below Public Shared Function UDP_Listen(ByVal Port As Integer) As Boolean Try UDP_Server_Port = Port UDP_Server = New UdpClient(Port) thdUdp = New Thread(AddressOf GetUDPData) thdUdp.Start() Catch e As Exception RaiseEvent Sock_Error(e.ToString) End Try End Function Private Sub UDPArrival(ByVal vData As String) TextBox1.Text = vData txtText.Text = vData xSock.UDP_Send("127.0.0.1", 10090, vData) End Sub so can you see how i can resolve this issue ? THanks so far :)

        T D 2 Replies Last reply
        0
        • T thedom2

          Hi Colin thats what I thought so something must be wrong. Its a windows app. Its starts off with a form starting at runtime named Hidden here is the code that triggers at load Private Sub Hidden_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load xSock.UDP_Listen(10080) AddHandler xSock.DataArrival, AddressOf UDPArrival End Sub in the above code it calls a class method as below Public Shared Function UDP_Listen(ByVal Port As Integer) As Boolean Try UDP_Server_Port = Port UDP_Server = New UdpClient(Port) thdUdp = New Thread(AddressOf GetUDPData) thdUdp.Start() Catch e As Exception RaiseEvent Sock_Error(e.ToString) End Try End Function Private Sub UDPArrival(ByVal vData As String) TextBox1.Text = vData txtText.Text = vData xSock.UDP_Send("127.0.0.1", 10090, vData) End Sub so can you see how i can resolve this issue ? THanks so far :)

          T Offline
          T Offline
          Tom Deketelaere
          wrote on last edited by
          #4

          you're problem is (I think) you start a new threat but never stop and close it so this thread still exists and on shutdown (of windows) windows does not know what to do with it (I think) try the following (just a guess) in the formclosing of you're main form put application.exit this should close all threads at once or you could just close the thread when it has finished hope this helps

          T 1 Reply Last reply
          0
          • T Tom Deketelaere

            you're problem is (I think) you start a new threat but never stop and close it so this thread still exists and on shutdown (of windows) windows does not know what to do with it (I think) try the following (just a guess) in the formclosing of you're main form put application.exit this should close all threads at once or you could just close the thread when it has finished hope this helps

            T Offline
            T Offline
            thedom2
            wrote on last edited by
            #5

            yep gave it a try but no luck unfortunately I have a sneeky feeling the form_closing is not firing when i try to exit or lof off.. surely someone knows why my crappy code is not working thanks anyway TDDragon =)

            C 1 Reply Last reply
            0
            • T thedom2

              yep gave it a try but no luck unfortunately I have a sneeky feeling the form_closing is not firing when i try to exit or lof off.. surely someone knows why my crappy code is not working thanks anyway TDDragon =)

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              Is there not an event on the application class that fires when Windows issues a shut down command? (It's been a while and I might be a bit rusty on that)


              Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

              T 1 Reply Last reply
              0
              • C Colin Angus Mackay

                Is there not an event on the application class that fires when Windows issues a shut down command? (It's been a while and I might be a bit rusty on that)


                Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

                T Offline
                T Offline
                thedom2
                wrote on last edited by
                #7

                nothing i can see thats fairly obvious. anyone else :) thanks Colin anyway

                1 Reply Last reply
                0
                • T thedom2

                  Hi Colin thats what I thought so something must be wrong. Its a windows app. Its starts off with a form starting at runtime named Hidden here is the code that triggers at load Private Sub Hidden_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load xSock.UDP_Listen(10080) AddHandler xSock.DataArrival, AddressOf UDPArrival End Sub in the above code it calls a class method as below Public Shared Function UDP_Listen(ByVal Port As Integer) As Boolean Try UDP_Server_Port = Port UDP_Server = New UdpClient(Port) thdUdp = New Thread(AddressOf GetUDPData) thdUdp.Start() Catch e As Exception RaiseEvent Sock_Error(e.ToString) End Try End Function Private Sub UDPArrival(ByVal vData As String) TextBox1.Text = vData txtText.Text = vData xSock.UDP_Send("127.0.0.1", 10090, vData) End Sub so can you see how i can resolve this issue ? THanks so far :)

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  It would appear your UI thread is blocked somewhere, but it's not obvious in the code you've posted. Single step through the execution of your server and watch the code run, line-by-line. If the debugger gets to a statement where it stops and doesn't execute the next line, you've found the block.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups