Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12.  
  13. namespace SilverlightApplication3
  14. {
  15. public partial class MainPage : UserControl
  16. {
  17. public MainPage()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22.  
  23. private void Knapp1_Click(object sender, RoutedEventArgs e)
  24. {
  25. int Integer1 = int.Parse(Textbox_alder.Text);
  26. int Integer2 = int.Parse(Textbox_alder.Text);
  27.  
  28.  
  29. if (Textbox_fornamn.Text == "")
  30. {
  31. MessageBox.Show("Du måste fylla i ett förnamn.");
  32. return;
  33. }
  34. if (Textbox_fornamn.Text.Length > 20)
  35. {
  36. MessageBox.Show("Max 20 tecken tillåtna.");
  37. return;
  38. }
  39. if (Textbox_efternamn.Text == "")
  40. {
  41. MessageBox.Show("Du måste fylla i ett efternamn.");
  42. return;
  43. }
  44. if (Textbox_efternamn.Text.Length > 20)
  45. {
  46. MessageBox.Show("Max 20 tecken tillåtna.");
  47. return;
  48. }
  49. if (Textbox_alder.Text == "")
  50. {
  51. MessageBox.Show("Du måste fylla i din ålder.");
  52. return;
  53. }
  54. if (Integer1 < 18)
  55. {
  56. MessageBox.Show("Du måste vara minst 18 år för att registrera.");
  57. return;
  58. }
  59. if (Integer2 > 45)
  60. {
  61. MessageBox.Show("Du får max vara 45 år för att registrera.");
  62. return;
  63. }
  64. if (Textbox_anvandarnamn.Text == "")
  65. {
  66. MessageBox.Show("Du måste fylla i ett användarnamn.");
  67. return;
  68. }
  69. if (Textbox_losenord.Password == "")
  70. {
  71. MessageBox.Show("Du måste fylla i ett lösenord.");
  72. return;
  73. }
  74. if (Textbox_losenord.Password.Length > 10)
  75. {
  76. MessageBox.Show("Lösenordet får max vara 10 tecken långt.");
  77. return;
  78. }
  79. if (Textbox_losenord.Password.Length < 6)
  80. {
  81. MessageBox.Show("Lösenordet måste vara minst 6 tecken långt.");
  82. return;
  83. }
  84. if (Textbox_bekrafta.Password == "")
  85. {
  86. MessageBox.Show("Du måste bekräfta lösenordet.");
  87. return;
  88. }
  89. if (Textbox_losenord.Password != Textbox_bekrafta.Password)
  90. {
  91. MessageBox.Show("Lösenorden stämmer inte överens. Vänligen kontrollera!");
  92. return;
  93. }
  94. if (Textbox_epostadress.Text == "")
  95. {
  96. MessageBox.Show("Du måste fylla i en e-postadress.");
  97. return;
  98. }
  99. else
  100. {
  101. MessageBox.Show("Dina uppgifter har blivit skickade!");
  102. }
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement