Hi!
Ich hab schon wieder was in C#, dass nicht geht:
Code:
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 MessageBox_Maker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Texte
string MessageBoxText;
MessageBoxText = textBox1.Text;
string MessageBoxUeberschrift;
MessageBoxUeberschrift = textBox2.Text;
//Radio Buttons Icon
if (radioButton1.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Asterisk;
}
else if(radioButton2.Checked == true){
MessageBoxIcon icon = MessageBoxIcon.Error;
}
else if (radioButton3.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Exclamation;
}
else if (radioButton4.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Hand;
}
else if (radioButton5.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Information;
}
else if (radioButton6.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Question;
}
else if (radioButton7.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Stop;
}
else if (radioButton8.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.Warning;
}
else if (radioButton9.Checked == true)
{
MessageBoxIcon icon = MessageBoxIcon.None;
}
//Radio Buttons Buttons
if (radioButton10.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.AbortRetryIgnore;
}
else if (radioButton11.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.OK;
}
else if (radioButton12.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.OKCancel;
}
else if (radioButton13.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.RetryCancel;
}
else if (radioButton14.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.YesNo;
}
else if (radioButton15.Checked == true)
{
MessageBoxButtons button = MessageBoxButtons.YesNoCancel;
}
//Message Box zeigen
MessageBox.Show(MessageBoxText, MessageBoxUeberschrift, button, icon);
}
}
}
Die Variablen button und icon sollten auch außerhalb verwendet werden können.
WIE GEHT DAS?
RSP-Fan