Progressbar updating

M

Michael

My Form_Main contains a progressbar the needs to be updated based on
calculation progress performed in several external modules called from the
Form_Main menu's.

Using the following code to access Form_Main from within the modules.

Private MyForm As Form_Main
MyForm = Form.ActiveForm
MyForm.ProgressBar1.Visible = True
MyForm.ProgressBar1.Value = CInt(50 * (n2 / NOEQ))

I get the following error when trying to run the program.

"Option Strict On disallows implicit conversions from
'System.Windows.Forms.Form' to MyProgram.Form_Main"

It will run if I turn off option strict, but I suspect there is a better
"more correct" way to update the progressbar.

Can anyone help

Thanks

Mike
 
H

Herfried K. Wagner [MVP]

* "Michael said:
Using the following code to access Form_Main from within the modules.

Private MyForm As Form_Main
MyForm = Form.ActiveForm

Replace the line above with this line:

\\\
MyForm = DirectCast(Form.ActiveForm, Form_Main)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top