我正在使用Infopath和VBA,並面臨一個小問題。我試着搜索這個,發現了一些例子,但不能正確理解它們(作爲新手)。單擊按鈕觸發多個按鈕單擊
我真的很感激,如果有人能把我推向正確的方向。
我想通過點擊一個名爲MasterSumbit
我在InternalStartup部分
Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
AddHandler DirectCast(EventManager.ControlEvents("Button1"), ButtonEvent).Clicked, AddressOf Button1_Clicked
AddHandler DirectCast(EventManager.ControlEvents("Button2"), ButtonEvent).Clicked, AddressOf Button2_Clicked
...and such for button 3 and 4
AddHandler DirectCast(EventManager.ControlEvents("MasterSubmit"), ButtonEvent).Clicked, AddressOf MasterSubmit_Clicked
End Sub
加載的事件處理程序按鈕來完成的四個按鈕(button1,2,3,4)執行代碼這是在MasterSubmit按鈕
Public Sub MasterSubmit_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
Button1_Clicked.click()
Button2_Clicked.click()
Button3_Clicked.click()
Button4_Clicked.click()
End Sub
我收到以下錯誤,每個按鈕的Click事件的代碼
Argument not specified for parameter 'e' of 'Public Sub Button1_Clicked(sender As Object, e As Microsoft.Office.InfoPath.ClickedEventArgs)'.
Argument not specified for parameter 'sender' of 'Public Sub Button1_Clicked(sender As Object, e As Microsoft.Office.InfoPath.ClickedEventArgs)'.
感謝預期
您是否在運行時添加了四個按鈕?如果沒有,你不能只是'Private Sub AnyButton_Click(sender As System.Object,e As System.EventArgs)Handles Button1.Click,Button2.Click,Button3.Click,Button4.Click'? – 2013-03-24 15:10:32
此外,你應該重新標記你的問題VB.Net。這絕對不是VBA :)。 – 2013-03-24 15:15:44
我曾嘗試把這個內部啓動部分後,但不工作。我很確定我做錯了! – user2204330 2013-04-27 06:30:15