Hi,
I am using below code to select a photo and I want to allow selcting photoz upto 1 MB only.
In the below code, when the user clicks OK it will close the dialog and then display the error message but how can I show the message without closing the box so use can select another photo?
OpenFileDialog dialogPicture = new OpenFileDialog();
dialogPicture.Title = "Employee Photo";
if (dialogPicture.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var file_size = new FileInfo(dialogPicture.FileName).Length;
if (file_size > 1048576)
{
XtraMessageBox.Show("File is larger than 1MB!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
Thanks,
Jassim