0 votes
1 view
in RPA by (5.4k points)

i  have this VB Code used in an Invoke Code Activity in UiPath. Can anyone suggest a function which changes the values of variable btnClicked in True when the button is pressed?

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

1 Answer

0 votes
by (9.5k points)

 I think all you need is to add a handler to the OnClick event. In Windows.Forms.Buttons this fires when the user clicks each time. 

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

then add the handler in your code

AddHandler lblbutton.Click, AddressOf My_Clicked_Event

Changing variables could simply be done using the casted lb…

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...