Build Errors - ambiguous reference??

S

Stephen Cairns

I have the following rpx file in a .Net solution and I am
getting the following build errors which are driving me
crazy and ive no idea where I have went wrong. The build
errors I'm getting are as follows: -
'CheckBox' is an ambiguous reference
'CheckBox' is an ambiguous reference
'Label' is an ambiguous reference
etc.................
Could someone please tell me where I have gone wrong.
Here is the rpx.cs file if this helps.
I would really appreciate any help I could be given. Sorry
I am very knew to coding and this could be a simple
problem but I can't work out what has gone wrong.

***************Code Behind Below**************
using System;
using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Document;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Causeway_Reports
{
public class Test : ActiveReport
{
public Test()
{
InitializeReport();
}

private void PageHeader_Format(object sender,
System.EventArgs eArgs)
{

}
private static SqlDataReader dr;

private void Test_ReportStart(object sender,
System.EventArgs eArgs)
{
int txtIPCURN = 45100;
//Create a Connection
SqlConnection conSQL = new SqlConnection
(ConfigurationSettings.AppSettings["DBConnectionString"]);
//Create a Command
SqlCommand cmdPPS11 = new SqlCommand
("select Incident.Type, IPC.DefendantType,
Recommendation.Notes, Offence.StartDate, Offence.EndDate,
Offence.ReportedDateTime, IPC.PrimaryOffenceCode,
Incident.Location, IPC.PettySessionsDistrict,
IPC.EarliestStatuteBarredDate,
IPC.InitialRemandApplicationFlag, IPC.PPSNIID,
IPC.PrimaryOffenceCode, IPC.CriminalBenefitGT10KFlag,
IPC.LinkedNotes, IPC.ComplaintType, IPC.OPONIRefNumber,
IPC.StatementOfFacts, IPC.URN, Ref_IPCFileType.
[description], Ref_IPCDefendantType.Description AS
[DEFDesc], Ref_RecommendationOverallType.Description as
[RECdesc] FROM IPC LEFT OUTER join Incident on IPC.URN =
Incident.IPCURN LEFT OUTER join IncidentOffence on
Incident.URN = IncidentOffence.IncidentURN LEFT OUTER join
Offence on Offence.URN = IncidentOffence.OffenceURN LEFT
OUTER join IPCRecommendation on IPC.URN =
IPCRecommendation.IPCURN LEFT OUTER join Recommendation on
IPCRecommendation.RecommendationID = Recommendation.ID
LEFT OUTER join Ref_IPCFileType on Ref_IPCFileType.code =
IPC.FileType LEFT OUTER join Ref_IPCDefendantType on
Ref_IPCDefendantType.code= IPC.DefendantType LEFT OUTER
join Ref_RecommendationOverallType on
Ref_RecommendationOverallType.code =
IPC.PSNIOverallRecommendation WHERE IPC.URN =" +
txtIPCURN, conSQL);

//if (conSQL.State == ConnectionState.Closed)
//{
conSQL.Open();
//}
//Create a datareader
//SqlDataReader dr;
dr = cmdPPS11.ExecuteReader();
}

private void Test_DataInitialize(object sender,
System.EventArgs eArgs)
{
Fields.Add("Type");
Fields.Add("DefendantType");
Fields.Add("Notes");
Fields.Add("StartDate");
Fields.Add("EndDate");
Fields.Add("ReportedDateTime");
Fields.Add("PrimaryOffenceCode");
Fields.Add("Location");
Fields.Add("PettySessionsDistrict");
Fields.Add("EarliestStatuteBarredDate");
Fields.Add("InitialRemandApplicationFlag");
Fields.Add("PPSNIID");
Fields.Add("PrimaryOffenceCode");
Fields.Add("CriminalBenefitGT10KFlag");
Fields.Add("LinkedNotes");
Fields.Add("ComplaintType");
Fields.Add("OPONIRefNumber");
Fields.Add("StatementOfFacts");
Fields.Add("URN");
Fields.Add("description");
Fields.Add("DEFDesc");
Fields.Add("RECdesc");
}

private void Test_FetchData(object sender,
DataDynamics.ActiveReports.ActiveReport.FetchEventArgs
eArgs)
{
try
{
dr.Read();
Fields["Type"].Value = dr["Type"].ToString();
Fields["DefendantType"].Value = dr
["DefendantType"].ToString();
Fields["Notes"].Value = dr["Notes"].ToString();
Fields["StartDate"].Value = dr["StartDate"].ToString();
Fields["EndDate"].Value = dr["EndDate"].ToString();
Fields["ReportedDateTime"].Value = dr
["ReportedDateTime"].ToString();
Fields["PrimaryOffenceCode"].Value = dr
["PrimaryOffenceCode"].ToString();
Fields["Location"].Value = dr["Location"].ToString();
Fields["PettySessionsDistrict"].Value = dr
["PettySessionsDistrict"].ToString();
Fields["EarliestStatuteBarredDate"].Value = dr
["EarliestStatuteBarredDate"].ToString();
Fields["InitialRemandApplicationFlag"].Value = dr
["InitialRemandApplicationFlag"].ToString();
Fields["PPSNIID"].Value = dr["PPSNIID"].ToString();
Fields["PrimaryOffenceCode"].Value = dr
["PrimaryOffenceCode"].ToString();
Fields["CriminalBenefitGT10KFlag"].Value = dr
["CriminalBenefitGT10KFlag"].ToString();
Fields["LinkedNotes"].Value = dr["LinkedNotes"].ToString();
Fields["ComplaintType"].Value = dr
["ComplaintType"].ToString();
Fields["OPONIRefNumber"].Value = dr
["OPONIRefNumber"].ToString();
Fields["StatementOfFacts"].Value = dr
["StatementOfFacts"].ToString();
Fields["URN"].Value = dr["URN"].ToString();
Fields["description"].Value = dr["description"].ToString();
Fields["DEFDesc"].Value = dr["DEFDesc"].ToString();
Fields["RECdesc"].Value = dr["RECdesc"].ToString();
eArgs.EOF =false;
}
catch
{
eArgs.EOF = true;
}
}

private void Detail_Format(object sender, System.EventArgs
eArgs)
{
// replace the following condition with your own
if(((CheckBox)Test.Sections["Detail"].Controls
["chcomplaint"]).text == "1")
{
((CheckBox)Test.Sections["Detail"].Controls
["chcomplaint"]).Checked = true;
}
else
{
((CheckBox)Test.Sections["Detail"].Controls
["chcomplaint"]).Checked = false;
}
}
#region ActiveReports Designer generated code
private ReportHeader ReportHeader = null;
private PageHeader PageHeader = null;
private Label Label1 = null;
private Shape Shape1 = null;
private Label Label2 = null;
private TextBox txtRefNum = null;
private Label Label3 = null;
private TextBox TextBox1 = null;
private Line Line6 = null;
private Picture imgNWLogo = null;
private Detail Detail = null;
private Shape Shape6 = null;
private Shape Shape4 = null;
private Shape Shape2 = null;
private Label Label4 = null;
private Label Label5 = null;
private Line Line2 = null;
private Line Line3 = null;
private Label Label6 = null;
private Label Label7 = null;
private Line Line4 = null;
private Label Label8 = null;
private TextBox txtNamesReported = null;
private Label Label9 = null;
private Label Label10 = null;
private CheckBox chScheduled = null;
private Label Label11 = null;
private Label Label12 = null;
private CheckBox CheckBox1 = null;
private Shape Shape3 = null;
private Label Label13 = null;
private Label Label14 = null;
private Label Label15 = null;
private Label Label16 = null;
private TextBox txtstartdate = null;
private TextBox txtEndDate = null;
private Label Label17 = null;
private TextBox txtdateTimeReported = null;
private Label Label18 = null;
private Label Label19 = null;
private TextBox txtcode = null;
private Label Label20 = null;
private TextBox txtLocation = null;
private Label Label21 = null;
private TextBox txtpetty = null;
private Label Label22 = null;
private TextBox txtEarStatue = null;
private Label Label23 = null;
private Label Label24 = null;
private CheckBox chcriminalben = null;
private Label Label25 = null;
private TextBox txtLinkedCases = null;
private Label Label26 = null;
private CheckBox chcomplaint = null;
private Label Label27 = null;
private TextBox txtOPONIREF = null;
private Label Label28 = null;
private Label Label29 = null;
private TextBox Number = null;
private Label Label30 = null;
private Label Label31 = null;
private TextBox txtSurname = null;
private Shape Shape5 = null;
private TextBox TextBox2 = null;
private TextBox txtFileType = null;
private TextBox txtDefendantType = null;
private TextBox txtRecommendation = null;
private TextBox TextBox3 = null;
private TextBox TextBox4 = null;
private TextBox TextBox5 = null;
private TextBox txtrank = null;
private Line Line7 = null;
private Line Line8 = null;
private Line Line9 = null;
private Line Line10 = null;
private Line Line11 = null;
private Line Line12 = null;
private Line Line13 = null;
private Line Line14 = null;
private Line Line15 = null;
private Line Line16 = null;
private Line Line17 = null;
private Line Line18 = null;
private PageFooter PageFooter = null;
private Label Label32 = null;
private ReportFooter ReportFooter = null;
public void InitializeReport()
{
this.LoadLayout(this.GetType
(), "Causeway_Reports.Test.rpx");
this.ReportHeader =
((DataDynamics.ActiveReports.ReportHeader)(this.Sections
["ReportHeader"]));
this.PageHeader = ((DataDynamics.ActiveReports.PageHeader)
(this.Sections["PageHeader"]));
this.Detail = ((DataDynamics.ActiveReports.Detail)
(this.Sections["Detail"]));
this.PageFooter = ((DataDynamics.ActiveReports.PageFooter)
(this.Sections["PageFooter"]));
this.ReportFooter =
((DataDynamics.ActiveReports.ReportFooter)(this.Sections
["ReportFooter"]));
this.Label1 = ((DataDynamics.ActiveReports.Label)
(this.PageHeader.Controls[0]));
this.Shape1 = ((DataDynamics.ActiveReports.Shape)
(this.PageHeader.Controls[1]));
this.Label2 = ((DataDynamics.ActiveReports.Label)
(this.PageHeader.Controls[2]));
this.txtRefNum = ((DataDynamics.ActiveReports.TextBox)
(this.PageHeader.Controls[3]));
this.Label3 = ((DataDynamics.ActiveReports.Label)
(this.PageHeader.Controls[4]));
this.TextBox1 = ((DataDynamics.ActiveReports.TextBox)
(this.PageHeader.Controls[5]));
this.Line6 = ((DataDynamics.ActiveReports.Line)
(this.PageHeader.Controls[6]));
this.imgNWLogo = ((DataDynamics.ActiveReports.Picture)
(this.PageHeader.Controls[7]));
this.Shape6 = ((DataDynamics.ActiveReports.Shape)
(this.Detail.Controls[0]));
this.Shape4 = ((DataDynamics.ActiveReports.Shape)
(this.Detail.Controls[1]));
this.Shape2 = ((DataDynamics.ActiveReports.Shape)
(this.Detail.Controls[2]));
this.Label4 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[3]));
this.Label5 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[4]));
this.Line2 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[5]));
this.Line3 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[6]));
this.Label6 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[7]));
this.Label7 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[8]));
this.Line4 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[9]));
this.Label8 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[10]));
this.txtNamesReported =
((DataDynamics.ActiveReports.TextBox)(this.Detail.Controls
[11]));
this.Label9 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[12]));
this.Label10 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[13]));
this.chScheduled = ((DataDynamics.ActiveReports.CheckBox)
(this.Detail.Controls[14]));
this.Label11 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[15]));
this.Label12 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[16]));
this.CheckBox1 = ((DataDynamics.ActiveReports.CheckBox)
(this.Detail.Controls[17]));
this.Shape3 = ((DataDynamics.ActiveReports.Shape)
(this.Detail.Controls[18]));
this.Label13 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[19]));
this.Label14 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[20]));
this.Label15 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[21]));
this.Label16 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[22]));
this.txtstartdate = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[23]));
this.txtEndDate = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[24]));
this.Label17 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[25]));
this.txtdateTimeReported =
((DataDynamics.ActiveReports.TextBox)(this.Detail.Controls
[26]));
this.Label18 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[27]));
this.Label19 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[28]));
this.txtcode = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[29]));
this.Label20 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[30]));
this.txtLocation = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[31]));
this.Label21 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[32]));
this.txtpetty = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[33]));
this.Label22 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[34]));
this.txtEarStatue = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[35]));
this.Label23 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[36]));
this.Label24 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[37]));
this.chcriminalben = ((DataDynamics.ActiveReports.CheckBox)
(this.Detail.Controls[38]));
this.Label25 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[39]));
this.txtLinkedCases = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[40]));
this.Label26 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[41]));
this.chcomplaint = ((DataDynamics.ActiveReports.CheckBox)
(this.Detail.Controls[42]));
this.Label27 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[43]));
this.txtOPONIREF = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[44]));
this.Label28 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[45]));
this.Label29 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[46]));
this.Number = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[47]));
this.Label30 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[48]));
this.Label31 = ((DataDynamics.ActiveReports.Label)
(this.Detail.Controls[49]));
this.txtSurname = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[50]));
this.Shape5 = ((DataDynamics.ActiveReports.Shape)
(this.Detail.Controls[51]));
this.TextBox2 = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[52]));
this.txtFileType = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[53]));
this.txtDefendantType =
((DataDynamics.ActiveReports.TextBox)(this.Detail.Controls
[54]));
this.txtRecommendation =
((DataDynamics.ActiveReports.TextBox)(this.Detail.Controls
[55]));
this.TextBox3 = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[56]));
this.TextBox4 = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[57]));
this.TextBox5 = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[58]));
this.txtrank = ((DataDynamics.ActiveReports.TextBox)
(this.Detail.Controls[59]));
this.Line7 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[60]));
this.Line8 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[61]));
this.Line9 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[62]));
this.Line10 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[63]));
this.Line11 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[64]));
this.Line12 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[65]));
this.Line13 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[66]));
this.Line14 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[67]));
this.Line15 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[68]));
this.Line16 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[69]));
this.Line17 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[70]));
this.Line18 = ((DataDynamics.ActiveReports.Line)
(this.Detail.Controls[71]));
this.Label32 = ((DataDynamics.ActiveReports.Label)
(this.PageFooter.Controls[0]));
// Attach Report Events
this.PageHeader.Format += new System.EventHandler
(this.PageHeader_Format);
this.ReportStart += new System.EventHandler
(this.Test_ReportStart);
this.DataInitialize += new System.EventHandler
(this.Test_DataInitialize);
this.FetchData += new
DataDynamics.ActiveReports.ActiveReport.FetchEventHandler
(this.Test_FetchData);
this.Detail.Format += new System.EventHandler
(this.Detail_Format);
}
#endregion
}
}
 
M

Morten Wennevik

Hi Stephen,

The problem is that there are two different CheckBoxes:

System.Windows.Forms.CheckBox and
System.Web.UI.WebControls.CheckBox

Since you declare

using System.Windows.Forms;
using System.Web.UI.WebControls;

The compiler gets confused as to which CheckBox you refer to in the code.
If you aren't creating a web application, the easiest solution is to delete or comment out

using System.Web.UI.WebControls;

Replacing all occurances of CheckBox with System.Windows.Forms.CheckBox will also solve this, in case you want to keep the WebControls line.

If you are creating a web application, delete or comment out the System.Windows.Forms part instead, or exchange every CheckBox to System.Web.UI.WebControls.CheckBox
 
Top