Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- namespace SilverlightApplication3
- {
- public partial class MainPage : UserControl
- {
- public MainPage()
- {
- InitializeComponent();
- }
- private void Knapp1_Click(object sender, RoutedEventArgs e)
- {
- int Integer1 = int.Parse(Textbox_alder.Text);
- int Integer2 = int.Parse(Textbox_alder.Text);
- if (Textbox_fornamn.Text == "")
- {
- MessageBox.Show("Du måste fylla i ett förnamn.");
- return;
- }
- if (Textbox_fornamn.Text.Length > 20)
- {
- MessageBox.Show("Max 20 tecken tillåtna.");
- return;
- }
- if (Textbox_efternamn.Text == "")
- {
- MessageBox.Show("Du måste fylla i ett efternamn.");
- return;
- }
- if (Textbox_efternamn.Text.Length > 20)
- {
- MessageBox.Show("Max 20 tecken tillåtna.");
- return;
- }
- if (Textbox_alder.Text == "")
- {
- MessageBox.Show("Du måste fylla i din ålder.");
- return;
- }
- if (Integer1 < 18)
- {
- MessageBox.Show("Du måste vara minst 18 år för att registrera.");
- return;
- }
- if (Integer2 > 45)
- {
- MessageBox.Show("Du får max vara 45 år för att registrera.");
- return;
- }
- if (Textbox_anvandarnamn.Text == "")
- {
- MessageBox.Show("Du måste fylla i ett användarnamn.");
- return;
- }
- if (Textbox_losenord.Password == "")
- {
- MessageBox.Show("Du måste fylla i ett lösenord.");
- return;
- }
- if (Textbox_losenord.Password.Length > 10)
- {
- MessageBox.Show("Lösenordet får max vara 10 tecken långt.");
- return;
- }
- if (Textbox_losenord.Password.Length < 6)
- {
- MessageBox.Show("Lösenordet måste vara minst 6 tecken långt.");
- return;
- }
- if (Textbox_bekrafta.Password == "")
- {
- MessageBox.Show("Du måste bekräfta lösenordet.");
- return;
- }
- if (Textbox_losenord.Password != Textbox_bekrafta.Password)
- {
- MessageBox.Show("Lösenorden stämmer inte överens. Vänligen kontrollera!");
- return;
- }
- if (Textbox_epostadress.Text == "")
- {
- MessageBox.Show("Du måste fylla i en e-postadress.");
- return;
- }
- else
- {
- MessageBox.Show("Dina uppgifter har blivit skickade!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement