簡體   English   中英

C#實例化類問題

[英]c# instantiating a class problem

我正在嘗試實例化類:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RadarGraphInsertDLL;


namespace EnterData.DataEntry
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void gaia_lom_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        {

        }

        protected void SubmitData(object sender, EventArgs e)
        {
            LOMDLL.Main_Lom_Form MainLomFormTable = PopulateMainForm();
            IList<LOMDLL.Lom_Batch> BatchTable = PopulateBatchTable();
            IList<LOMDLL.Lom_Problem> ProblemTable = PopulateProblemTable();
            IList<LOMDLL.Lom_Specimen> SpecimenTable = PopulateSpecimenTable();
        }


    }
}

但出現此錯誤:

Error   19  The type name 'Main_Lom_Form' does not exist in the type 'EnterData.DataEntry.WebForm1.LOMDLL'  C:\Documents and Settings\agordon\My Documents\Visual Studio 2008\Projects\lomdb\EnterData\DataEntry\DAL.cs 64  55  EnterData

但是我有這些!

public class Main_Lom_Form
{
    public int lom_number {get;set;}
    public DateTime occurrence_date {get;set;}
    public DateTime report_date {get;set;}
    public string report_by {get;set;}
    public string identified_by {get;set;}
    public string section_c_issue_error_identified_by{get;set;}
    public string section_c_comments{get;set;}
    public string section_d_investigation{get;set;}
    public string section_e_corrective_action{get;set;}
    public string section_f_comments{get;set;}
    public string pre_practice_code{get;set;}
    public string pre_contact{get;set;}
}
public class Lom_Batch
{
    public int lom_number { get; set; }
    public string batch { get; set; }
}
public class Lom_Problem
{
    public int lom_number { get; set; }
    public string problem { get; set; }
}
public class Lom_Specimen
{
    public int lom_number { get; set; }
    public string specimen { get; set; }
}

我無法實例化類的原因是什么?

我將假設這里沒有顯示其他編譯器錯誤。 從類定義中刪除static關鍵字。 您不能實例化靜態類。

您沒有提供完整的編譯器錯誤消息列表。 沒有這些,我們真的無法提供幫助。 您不知道問題出在哪里,因此選擇和分享您的線索是不明智的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM