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. prevent MessageBox from continuously reappearing

prevent MessageBox from continuously reappearing

Scheduled Pinned Locked Moved C#
questionsysadmin
7 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.
  • B Offline
    B Offline
    batmanAgen
    wrote on last edited by
    #1

    hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)

    G A E 3 Replies Last reply
    0
    • B batmanAgen

      hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      How long a message box is displayed is controlled by the user. If you want to remove the messagebox by code, you can't use a messagebox. Use a small form instead. --- b { font-weight: normal; } -- modified at 8:25 Monday 27th February, 2006

      B 1 Reply Last reply
      0
      • G Guffa

        How long a message box is displayed is controlled by the user. If you want to remove the messagebox by code, you can't use a messagebox. Use a small form instead. --- b { font-weight: normal; } -- modified at 8:25 Monday 27th February, 2006

        B Offline
        B Offline
        batmanAgen
        wrote on last edited by
        #3

        thanks for the reply..:) ok, i thnk ill use a form as you suggested. how can automatically close the form? will i use a timer?

        1 Reply Last reply
        0
        • B batmanAgen

          hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)

          A Offline
          A Offline
          autekre
          wrote on last edited by
          #4

          Couldnt you just use a bool value to indicate whether or not its shown (might have to create it as an object for this) and use an if statement to act accordingly ?

          B 1 Reply Last reply
          0
          • A autekre

            Couldnt you just use a bool value to indicate whether or not its shown (might have to create it as an object for this) and use an if statement to act accordingly ?

            B Offline
            B Offline
            batmanAgen
            wrote on last edited by
            #5

            uhhh how is dat possible autekre?:) is that for the messagebox or the form?

            1 Reply Last reply
            0
            • B batmanAgen

              hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)

              E Offline
              E Offline
              Eric Dahlvang
              wrote on last edited by
              #6

              public partial class Form1 : Form { private Boolean lShowedOnce = false; public Form1() { InitializeComponent(); } private void Timer1_Tick(object Sender, EventArgs e) { if (this.Tag != "Connected") { if (!lShowedOnce) { lShowedOnce = true; MessageBox.Show("You are not connected to the server...."); } if (ConnectToServer()) this.Tag = "Connected"; } } private Boolean ConnectToServer() { Boolean lConnected = false; //Attempt to connect to the server right here return (lConnected); } } ---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollin

              B 1 Reply Last reply
              0
              • E Eric Dahlvang

                public partial class Form1 : Form { private Boolean lShowedOnce = false; public Form1() { InitializeComponent(); } private void Timer1_Tick(object Sender, EventArgs e) { if (this.Tag != "Connected") { if (!lShowedOnce) { lShowedOnce = true; MessageBox.Show("You are not connected to the server...."); } if (ConnectToServer()) this.Tag = "Connected"; } } private Boolean ConnectToServer() { Boolean lConnected = false; //Attempt to connect to the server right here return (lConnected); } } ---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollin

                B Offline
                B Offline
                batmanAgen
                wrote on last edited by
                #7

                hey thanks man!:D i'll try this code immediately..:D i really appreciate it..:D

                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