Info Please

  • Thread starter Thread starter settyv
  • Start date Start date
S

settyv

Hi,

I want to display Business exceptions in Messagebox in asp.net.For
that i used MessageBox
API function.But when i tried calling this function from UI,it is not
displaying messagebox.Please let me know what vould be the problem.


Here is the UI where am calling the function:

private void btnCaseSearch_Click(object sender, System.EventArgs e)
{
Case BCase=new Case ();
SearchParams sp=new SearchParams();
sp.FirstName = txtFirstName.Text;
sp.MiddleName = txtMidName.Text ;
sp.LastName = txtLastName.Text;
if(txtToFiledDate.Text.ToString()=="" ||
txtFromFiledDate.Text.ToString()=="" )
{
sp.FiledTo =DateTime.MaxValue;
sp.FiledFrom = DateTime.MinValue ;
}


if( sp.FirstName==null || sp.LastName==null || sp.MiddleName==null
|| sp.FiledFrom==DateTime.MinValue )
{
BCase.Validate(sp);
//BCase.CheckFieldReqs();


}
else
{
DisplayCaseSearchResults();
}

}



Here is the Validate Function in BLL

[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int
type);
public override void Validate(SearchParams sp)
{

//Validate fields
//base.Validate ();


if (sp.FirstName == null || sp.LastName == null || sp.MiddleName ==
null || sp.Organization == null || sp.FiledFrom == DateTime.MinValue ||
sp.FiledTo == DateTime.MinValue || sp.DisplayCaseNum == null ||
sp.CaseCatCode == null)
{
//throw new ApplicationException("Please select any of the item");
MessageBox(0,"Please select any of the item","Case Search",0);

}


Please let me know why am not able to show the messagebox.

Thanks,
Vishnu
 
the messagebox if it worked would appear on the server. but services like
asp.net do not have permission to the desktop, so the messagebox call fails.

-- bruce (sqlwork.com)
 
Back
Top