c# - Verifying Controls on a Windows Form -
i have windows written in c# , wanted verify data in each control (dropdown, textbox, etc) not null before saving data database. have multiple forms in application. how go doing it? thinking create boolean function.
you can write simple method loop through controls in form , check control values.
private bool checkcontrols() { foreach (control ctrl in this.controls) { //write code check whether control value null //case: testbox return true; //case: dropdown return true; //case: listbox return true; //..etc } return false; }
Comments
Post a Comment