我在UiPath的调用代码活动中使用了此VB代码。有人可以建议一个函数,当按下按钮时,该函数会更改True中变量btnClicked的值吗?
Dim lblButton As New System.Windows.Forms.Button()
lblButton.AutoSize = True
btnClicked=False
lblButton.ForeColor = System.Drawing.Color.Black
'lblButton.Location = New System.Drawing.Point(5, 10)
lblButton.Left=250
lblButton.Name = "lblButton"
lblButton.Size = New System.Drawing.Size(50, 50)
lblButton.TabIndex = 4
lblButton.Text = "End data acq"
lblbutton.Visible=btnVisible
btnClicked=True
答案 0 :(得分:0)
我认为您所需要的只是向OnClick事件添加处理程序。在Windows.Forms.Buttons中,这将在用户每次单击时触发。我对rpa或uipath没有任何经验,所以如果这不是一个完整的答案,我会致歉。
Private Sub My_Clicked_Event(sender As Object, e As EventArgs)
Dim lb As System.Windows.Forms.Button = DirectCast(sender, System.Windows.Forms.Button)
lb.Text = "I have been clicked"
lb.Forecolor = Color.Black
MsgBox("Clicked")
End Sub
然后在代码中添加处理程序
AddHandler lblbutton.Click, AddressOf My_Clicked_Event
更改变量只需使用强制转换的lb ...