Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Validation
- {
- public static bool textFieldInteTomt(TextBox field, string label)
- {
- if (field.Text == "")
- {
- MessageBox.Show(label + " måste fyllas i. Vänligen ange ett värde.");
- field.Focus();
- return false;
- }
- else
- {
- return true;
- }
- }
- public static bool kollaUrl(string url)
- {
- try
- {
- var xml = "";
- using (var client = new System.Net.WebClient())
- {
- client.Encoding = Encoding.UTF8;
- xml = client.DownloadString(url);
- return true;
- }
- }
- catch (Exception)
- {
- MessageBox.Show("Vänligen ange en korrekt url.");
- return false;
- }
- }
- public static bool comboBoxInteTomt(ComboBox combo, string label)
- {
- if (combo.Text == "")
- {
- MessageBox.Show(label + " är inte valt, vänligen ange ett " + label);
- combo.Focus();
- return false;
- }
- else
- {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement