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. C#
  4. Status Bar

Status Bar

Scheduled Pinned Locked Moved C#
question
4 Posts 3 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.
  • S Offline
    S Offline
    Sean89
    wrote on last edited by
    #1

    I have the following code:

    try
    {
         statusLabel.Text = "Attemting to connect...";
         DataCon.Open();
    
         ....
    }
    

    Why dosn't "Attempting to connect..." show in the status bar until it has connected?

    J M 2 Replies Last reply
    0
    • S Sean89

      I have the following code:

      try
      {
           statusLabel.Text = "Attemting to connect...";
           DataCon.Open();
      
           ....
      }
      

      Why dosn't "Attempting to connect..." show in the status bar until it has connected?

      J Offline
      J Offline
      jklucker
      wrote on last edited by
      #2

      Use Application.DoEvents() try { statusLabel.Text = Attempting to connect..."; Application.DoEvents(); DataCon.Open(); } Basically calling the Application.DoEvents() forces your application to process everything up that point before proceeding to the next step in your code. Without it your user interface will appear to lock up until your done working with your data connection stuff. The other way to accomplish this would be to spawn your data connection stuff on another thread which then would make the main thread process the UI changes. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

      S 1 Reply Last reply
      0
      • S Sean89

        I have the following code:

        try
        {
             statusLabel.Text = "Attemting to connect...";
             DataCon.Open();
        
             ....
        }
        

        Why dosn't "Attempting to connect..." show in the status bar until it has connected?

        M Offline
        M Offline
        mcljava
        wrote on last edited by
        #3

        the StatusBar component is a little tricky. Does your StatusBar have panels? If so you should be addressing the panel to which you want the data to appear. For example, say you had statusBar1 and statusBarPanel1 defined in your app. Use statusBarPanel1.Text = "blah blah blah". Good luck Mike Luster CTI/IVR/Telephony SME

        1 Reply Last reply
        0
        • J jklucker

          Use Application.DoEvents() try { statusLabel.Text = Attempting to connect..."; Application.DoEvents(); DataCon.Open(); } Basically calling the Application.DoEvents() forces your application to process everything up that point before proceeding to the next step in your code. Without it your user interface will appear to lock up until your done working with your data connection stuff. The other way to accomplish this would be to spawn your data connection stuff on another thread which then would make the main thread process the UI changes. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

          S Offline
          S Offline
          Sean89
          wrote on last edited by
          #4

          Thanks! Thought it would be something small like that. Works fine now ;P

          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