Jak zrobić aby przy wpisywaniu adresu email gdy ktoś zapomni dać kropki
to zeby wyskakiwał błąd taki sam jak przy braku @
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace XXXXXXXXXX
{
public partial class FmAdresEMail : Form
{
public string adres = "";
public FmAdresEMail()
{
InitializeComponent();
}
private void btAnuluj_Click(object sender, EventArgs e)
{
this.Close();
}
private void btDodaj_Click(object sender, EventArgs e)
{
if (tbAdres.Text.Length == 0)
{
MessageBox.Show("Podaj adres e-mail.", "Brak adresu e-mail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
tbAdres.Focus();
return;
}
if (!tbAdres.Text.Contains("@"))
{
MessageBox.Show("Błędny adres e-mail.", "Błędny adres e-mail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
tbAdres.Focus();
return;
}
if (!tbAdres.Text.Contains("."))
{
MessageBox.Show("Błędny adres e-mail.", "Błędny adres e-mail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
tbAdres.Focus();
return;
}
adres = tbAdres.Text;
this.Close();
}
}
}
(chodzi o kropke przed com /pl itp ( np.xxxxxx@xxx.pl )
Dodatkowo moze ktos bedzie wiedzial jak zrobic aby blad wyskakiwal tez przy np wpisaniu czegos typu >:">":>":>@">@$"
albo np program@