简体   繁体   中英

How to show multiple message boxes

I want to show multiple message box with time spend, that is if 1 minute goes it shows 1 popup if two then two message box will be appear.

MessageBox.Show(this,
            "hello i am message box.",
            "Rambo forever",
            MessageBoxButtons.OK,            
            MessageBoxDefaultButton.Button1,
            (MessageBoxOptions)0x40000);

I didn't fully understand what exactly you want to make, but I hope this will help you:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static int t = 1800;
        public static bool msg = false;

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            timer1.Interval = t;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (msg == false)
            {
                msg = true;
                MessageBox.Show("Some text here.", "");
                msg = false;
            }
        }
    }
}

It will create a new message box every one minute if previous message box is closed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM