0

嗨,我有这样的 MDI 表单的 ac# 代码-

private void tlstrpmenuAppointments_Click(object sender, EventArgs e)
{
    Appointments AppointmentsObject = new Appointments(Controller.Ulink1);
    AppointmentsObject.MdiParent = FrmMainConsole.ActiveForm;
    AppointmentsObject.Show();
}

此 MDI 有一个名为 Appointments 的子表单,其中包含以下代码 -

private void Appointments_Load(object sender, EventArgs e)
    {
        cmbSearchColoumn.SelectedIndex = 0;

        lblDoctorName.Text =lblDoctorName.Text+" "+ dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString() + " " + dt.Rows[0].ItemArray[3].ToString();

        //Load todays Time Slots-
        DataTable temp = new DataTable();

        // **THE PROBLEM LIES IN THE FOLLOWING STATEMENT**
        temp = appointmentsCLObject.GetTimeSlots(docid);
       // THIS CALLS THE BAL STATED BELOW THIS CODE.

        cmbTimeSlotsAvailable.DisplayMember = temp.Columns[1].ToString();
        cmbTimeSlotsAvailable.ValueMember = temp.Columns[0].ToString();
        cmbTimeSlotsAvailable.DataSource = temp;
        cmbTimeSlotsAvailable.SelectedIndex = 0;

        //Loading Patient Lists for Consulting.
        dt1 = appointmentsCLObject.GetAppointments(DateTime.Now, Convert.ToInt16(cmbTimeSlotsAvailable.SelectedValue), docid);
        dtgridAppointments.DataSource = dt1;
    }

BAL 如下 -

public DataTable GetTimeSlots(int Docid)
    {
        DateTime dt=new DateTime();
        dt = DateTime.Now;
        DataTable dtable= appointmentMLObject.GetTimeSlots(Docid,(int)dt.DayOfWeek);
        DataTable ReturnTable = new DataTable();
        foreach (DataRow rw in dtable.Rows)
        {
            ReturnTable.Rows.Add(rw[0].ToString(),rw[1].ToString()+" "+rw[2].ToString());
        }

        // **PROBLEM START**
        return ReturnTable;
    }

**当调用return语句时,代码不会返回到它的调用方法!(??) 相反,它返回到已创建此子窗体的对象的 MDI。

它返回到语句

AppointmentsObject.Show();

并向我展示了其中没有数据的表格。

4

0 回答 0