Hello all:
I've yet to find information concerning the ReportObjectHitTest. However, downloading your free chapters helped me to accomplish the desired task. (So, meet your newest customer. I must have both of your books. They've been added to my Christmas List.) Thanks a million.
Using the CrystalReportViewer ObjectModel's Drill() event, I am able to pass information from the Report Document to a class that I created called Reports. This class uses the information that it receives, to select data from the database that corresponds to the received id.
This also allows me to determine which records information should be displayed in the form when it's launched via the Drill() event.
//instantiate 3 instances of the Reports object
Reports newIncReport = new Reports();
Reports newMsgReport = new Reports();
Reports newAssgntReport = new Reports();
private void MWSRptVwr_Drill(object source, CrystalDecisions.Windows.Forms.DrillEventArgs e)
{
//this id will be passed to the results class; it is the id that is being displayed in a Crystal Report on the main gui form
string id = e.NewGroupName;
bool found = false;
//determine which report is currently displayed
switch (activeReport){
case "incidents":
//pass the incident id to the reports class
found = newIncReport.IdentifyIncReportSelection(id);
if (found){
//do not perform the drilldown
e.Handled = true;
//create an instance of the New Incident form
frmNewIncident newIncident = new frmNewIncident(id);
//display the new form and information that corresponds to the id
newIncident.Show();
}
break;
case "messages":
//pass the message id to the reports class
found = newMsgReport.IdentifyMsgReportSelection(id);
if (found){
//do not perform the drilldown
e.Handled = true;
//create an instance of the Message Details form
frmMsgDetails msgDetails = new frmMsgDetails(id);
//display the new form and information that corresponds to the id
msgDetails.ShowDialog();
}
break;
case "assignments":
//pass the assignments id to the reports class
found = newAssgntReport.IdentifyAsgntReportSelection(id);
if (found){
//do not perform the drilldown
e.Handled = true;
//create an instance of the Update Assignment form
frmUpdate updateAsgnt = new frmUpdate(id);
//display the new form and information that corresponds to the id
updateAsgnt.ShowDialog();
}
break;
}
}
If you find the code useful, please, help yourself to it. Once you capture that id, there are endless possibilities! Have fun!
Note: The id argument is used in conjunction with a datareader to determine if a field value matches the id.
bool found = false;
while (dbReader.Read()){
if (id == (dbReader["someFieldName"])
found = true;
}
}
return found;
Edited by squeaky - 05 Dec 2006 at 5:53pm