Skip to content

Instantly share code, notes, and snippets.

@KrabCode
Created October 16, 2017 14:24
Show Gist options
  • Save KrabCode/46e08c72621a037fa377f8008b7ee242 to your computer and use it in GitHub Desktop.
Save KrabCode/46e08c72621a037fa377f8008b7ee242 to your computer and use it in GitHub Desktop.
Shows a MessageBox with custom message, closes on OK
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 Reminder
{
public partial class Form1 : Form
{
string header = "hi it's me your liver";
string text = "no bad thoughts" +
System.Environment.NewLine + "run away instead";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
showAlert(text);
}
private void showAlert(string s)
{
if (MessageBox.Show(text, header, MessageBoxButtons.OK) == DialogResult.OK)
{
Close();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment