2013-02-14 59 views
1

我在同時顯示父窗體和報表時遇到問題。當用戶單擊父窗體進行打印時,它應該彈出是或否按鈕,當用戶單擊是按鈕時,它應該打印窗體屏幕快照圖像,如果我們點擊「否」按鈕,它應該顯示水晶報告。如何在顯示報告表單後顯示父表單?

當我們單擊「否」按鈕,它應該顯示晶體report.So以顯示消息框我有這樣 me.hide()

if MsgBox('Do you want to print screen shot image?') then 
'Print screen shot image 
me.Show() 
else 
'Show CxReport 
me.Show() 
end if 

當我做這樣的父窗體是完成闖入並且無法執行操作。

+0

你使用類似的最頂層或ShowDialog的? – jAC 2013-02-14 05:55:30

+0

我沒有使用上面提到的任何一個。 :-( – 2013-02-14 06:02:05

+0

都是'Forms'在當時打開,'MessageBox'出現嗎? – jAC 2013-02-14 06:56:29

回答

0

顯示對話框時隱藏表單不是標準做法。完全刪除me.hide和me.show行並重試。

0

我知道這個問題是一個老問題,你現在可能已經想通了,但我想我會爲將來的參考添加一個答案。所有Forms都有FormClosingFormClosed您可以在創建窗體中附加處理程序的事件。這是我想說的一個簡單的例子。

Public Class Form1 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
     Me.Hide() 
     If MsgBox("Open Report?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then 
      Dim frm2 As Form2 = New Form2 
      AddHandler frm2.FormClosed, AddressOf ReportClosing 
      frm2.Show(Me) 
     Else 
      Me.Show() 
      'Do your work for printing form here 
     End If 

    End Sub 

    Private Sub ReportClosing(sender As Object, e As FormClosedEventArgs) 
     'Remove handler to prevent memory leaks 
     RemoveHandler DirectCast(sender, Form2).FormClosed, AddressOf ReportClosing 
     Me.Show() 
    End Sub 

End Class 
0

Atlast我發現來獲得訪問父頁面hiddenField值遠低於

function getParentPageHField() { 
    var parentPageHField = window.opener.document.getElementById('hSelectedStandard').value; 
    document.getElementById('hStandard').value = parentPageHField; 
} 

感謝給出您輸入:-)