Guest User

Untitled

a guest
Jun 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void button1_Click(object sender, EventArgs e)
  20. {
  21. bool hasEmpty = false;
  22.  
  23. var controls = groupBox1.Controls.OfType<TextBox>();
  24. foreach(Control c in controls)
  25. {
  26. if(string.IsNullOrEmpty(c.Text))
  27. {
  28. hasEmpty = true;
  29. }
  30. }
  31.  
  32. if(hasEmpty)
  33. {
  34. // ERROR!
  35. }
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment