2014-04-15 7 views
2

저는 vb.net을 처음 사용하며 항상 해결책을 찾고 있습니다. 관련된 양식은 MainMenu, poCustom 및 rdlcForm입니다. MDI 양식으로 새로운 모습이 나올 때까지 모두 잘 작동합니다.MDI 양식 Groupbox에서 텍스트 상자의 값을 가져 오는 방법은 무엇입니까?

내 "새"MainMenu에 이제 그룹 상자에 poCustom이 포함됩니다. 내가

으로 코드를 검색하는
For Each f As Form In Application.OpenForms 
     If TypeOf f Is poCustom Then 
      f.Activate() 
      Return 
     End If 
    Next 

    Dim ch As New poCustom 
    ch.TopLevel = False 
    ch.Visible = True 

    ch.StartPosition = FormStartPosition.Manual 
    Dim leftStart As Integer = 1220 - (ch.Width + (SystemInformation.Border3DSize.Width * 2)) 
    Dim topStart As Integer = 670 - (ch.Height + (SystemInformation.Border3DSize.Height * 2)) 

    ch.Location = New Point(leftStart, topStart) 

    GroupBox1.Controls.Add(ch) 

문제 : rdlcForm (보고서) poCustom 형태로 텍스트 상자의 값을 얻을 수 없습니다. 아래 코드 :

Private Sub rptPOView2_Load(sender As Object, e As EventArgs) Handles MyBase.Load 
    Dim rptParam1(11) As Microsoft.Reporting.WinForms.ReportParameter 
    rptParam1(0) = New Microsoft.Reporting.WinForms.ReportParameter("rptDate", poCustom.Label1.Text) 
    rptParam1(1) = New Microsoft.Reporting.WinForms.ReportParameter("rptREF", poCustom.Label5.Text) 
    rptParam1(2) = New Microsoft.Reporting.WinForms.ReportParameter("rptCompany", poCustom.CompanyName.Text) 
    rptParam1(3) = New Microsoft.Reporting.WinForms.ReportParameter("rptQTY", poCustom.txBoxQTY.Text) 
    rptParam1(4) = New Microsoft.Reporting.WinForms.ReportParameter("rptUOM", poCustom.txBoxUOM.Text) 
    rptParam1(5) = New Microsoft.Reporting.WinForms.ReportParameter("rptDesciption", poCustom.txBoxDesc.Text) 
    rptParam1(6) = New Microsoft.Reporting.WinForms.ReportParameter("rptUnit", poCustom.txBoxUnit.Text) 
    rptParam1(7) = New Microsoft.Reporting.WinForms.ReportParameter("rptTotal", poCustom.txBoxTotal.Text) 
    rptParam1(8) = New Microsoft.Reporting.WinForms.ReportParameter("rptSubTotal", poCustom.Label25.Text) 
    rptParam1(9) = New Microsoft.Reporting.WinForms.ReportParameter("rptVAT", poCustom.Label26.Text) 
    rptParam1(10) = New Microsoft.Reporting.WinForms.ReportParameter("rptTotalAmount", poCustom.Label27.Text) 
    rptParam1(11) = New Microsoft.Reporting.WinForms.ReportParameter("rptRequest", poCustom.Label30.Text) 

    ReportViewer1.LocalReport.SetParameters(rptParam1) 
    Me.ReportViewer1.RefreshReport() 

    TextBox1.Text = poCustom.CompanyName.Text 
End Sub 

MDI 양식을 사용하지 않으면 작동합니다. 나는 미래의 사용을 위해 문제의 원인을 알고 싶다. 미리 감사드립니다.

+0

'poCustom'이란 무엇입니까? 그리고'ReportParameter ("rptDate", POForm.Label1.Text)와 같이'poCustom' 대신'POForm'을 사용하면 안됩니다. – Arman

+0

정말 미안 해요, 구매 주문서에는 poDefault와 poCustom의 두 가지 양식이 있습니다. 내 질문을 죄송합니다. – user3214105

+0

나는 poCustom의 다른 인스턴스를 사용하고 있다고 생각한다. – Arman

답변

1

두 개의 다른 인스턴스 인 poCustom을 사용하고 있습니다. ch이 첫 번째이며 해당 텍스트 상자를 채 웁니다. 그러나 rptPOView2_Load 이벤트에서 값이없는 텍스트 상자가 포함 된 다른 인스턴스를 사용하고 있습니다. 문제를 해결하는 한 가지 방법은 poCustom 자체를 사용하는 것이며 ch이 아니라 사용하는 것입니다.

poCustom.TopLevel = False 
poCustom.Visible = True 

poCustom.StartPosition = FormStartPosition.Manual 
Dim leftStart As Integer = 1220 - (ch.Width + (SystemInformation.Border3DSize.Width * 2)) 
Dim topStart As Integer = 670 - (ch.Height + (SystemInformation.Border3DSize.Height * 2)) 

poCustom.Location = New Point(leftStart, topStart) 

GroupBox1.Controls.Add(poCustom) 
관련 문제