Display Form through UIPath

Hello,

You were pretty close, just some small change to make on the code first:

Dim formsA As AssemblyReference=System.Reflection.Assembly.LoadWithPartialName(“System.Windows.Forms”)
Using formsA
Dim frm As Form = New Form
Dim bar As ProgressBar = New ProgressBar()
bar.Location = New System.Drawing.Point(50, 20)
bar.Name = “progressBar1”
bar.Size = New System.Drawing.Size(171, 23)
bar.TabIndex = 0
bar.Style = ProgressBarStyle.Marquee
bar.Minimum = 0
bar.Maximum = 100
frm.Controls.Add(bar)
frm.Show()
End Using

Remove part in bold, We will use another way to import except the New just before progressBar that you will need to add

Then we will need to import Namespace using the “Import” Panel (close to the variable panel on the bottom and look for System.Windows.Forms and click it when it appears on the drop-down.

image

The last step, in order to have it functional, you need to create a variable under the variable panel, with a type coming from WindowsForm namespace (on my example frmOne as System.Windows.Forms.Form)

By doing this, it will say UiPath that it needs to import System.Windows.Forms namespace when it will compile. The same manipulation is done when you want to import external (custom) namespace within UiPath

image

Now you should be able to run it correctly.

In case, Find here the copy of your wf amended

Main.xaml (9.0 KB)

Cheers.

7 Likes