Arg81
Well-known member
I've put together some basic validation for when a user adds a record to my database;
So basically if the user has forgot to input in one of the fields, a messagebox shows telling them.
However, if there are two fields without data, only one messagebox is shown.
Is it possible to have each smessage on a seperate line of the same messagebox, i;e;
The following needs to be entered:
Customer Name
For Attention Of
Account Manager
{OK}
I've seen how to do this somewhere, I've checked all my books but can't find it, and now I'm going mad!!!!
Thanks for any help on this.
Regards,
Luke
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] ValidData() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Boolean
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sMessage [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] txtCustomer.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'Customer Name' required."
lblSelect.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] txtFAO.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'For the Attention Of' required."
lblSelect.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] dtpRequestDate.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'Date of Request' required."
dtpRequestDate.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] cboShipBy.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'Ship By' required."
cboShipBy.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] cboAccountManager.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'Account Manager' required."
cboAccountManager.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] cboRequestedBy.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]sMessage = "'Requested By' required."
cboRequestedBy.Focus()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] sMessage = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]ValidData = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]ValidData = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]MessageBox.Show(sMessage, "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE]
So basically if the user has forgot to input in one of the fields, a messagebox shows telling them.
However, if there are two fields without data, only one messagebox is shown.
Is it possible to have each smessage on a seperate line of the same messagebox, i;e;
The following needs to be entered:
Customer Name
For Attention Of
Account Manager
{OK}
I've seen how to do this somewhere, I've checked all my books but can't find it, and now I'm going mad!!!!
Thanks for any help on this.
Regards,
Luke