I tried and reached the goal
Check all textbox on form, if textbox null/empty, to be cursor to location null.
Messagebox and break;
AT FORM
namespace LabWinForm
{
public partial class frmTxtNull : Form
{
public frmTxtNull()
{
InitializeComponent();
}
private void btnCheckNull_Click(object sender, EventArgs e)
{
foreach (Control item in this.Controls)
{
if (item.GetType() == typeof(TextBox))
{
if (iBookFunct.CheckTxtNull(item))
return;
}
}
MessageBox.Show("Hello world");
}
}
}
AT STATIC CLASS
namespace LabWinForm
public static class PublicFunct
{
public static bool CheckTxtNull(Control ctrl)
{
bool result;
if (string.IsNullOrEmpty(ctrl.Text))
{
MessageBox.Show("Data fields should not be blank.");
result = true;
ctrl.Focus();
}
else
{
result = false;
}
return result;
}
}
Thank everyone!