Q: Progress control in a subform

G

Geoff Jones

Hi

I posted a question yesterday but didn't get any replies - probably because
I didn't give enough information to what I'm trying to do, so here we go
again but this time with a bit more detail:

In my main application form, I am performing some lengthy calculations.
During these calculations I want to display another form with a progress
control in it to give the user an idea of how far the calculations have
gone. For the sake of argument, let the main form be called Form1 and the
form with the progress control Form2.

The pseudo code I have written below gives an idea of what I am doing at
present:

'In the code of Form1
Dim frm2 As New Form2
frm2.Show()
frm2.ProgressControl1.Minimum = 1
frm2.ProgressControl1.Maximum = 1000
For count=1 To 1000
' Do some calculations
frm2.ProgressControl1.Increment(1) ' Increment the progress control
End For
frm2.Hide()

etc.

This does work! However, the form which includes the progress control is not
centered in Form1. I've tried using StartPosition and CenterParent.

Can anybody help me do this?

Thanks in advance

Geoff
 
R

Richard Myers

This does work! However, the form which includes the progress control is
not
centered in Form1. I've tried using StartPosition and CenterParent.

Gidday Geoff

Three words for you my friend.

Location!Location!Location!

Change your Center parent to Manual and then set the Location porpoerty of
the form before you show it.

dim frm as frmMyProgress()
With frm
.StartPostion = FormStartPosition.Manual ' Although you'd set this
in properties of the progress form
.Location = myCalcPos
.Owner = Me
.ShowDialog
.Dispose
End With

Where myCalcPos is just a simple calc getting the width of the owner forms
and progress forms and dividing by 2
to get the center etc etc..

Note check my syntax ( i may have got a couple of those property names
wrong)

Oao
Richard
 
G

Geoff Jones

Hi Cor/Richard

Many thanks for your suggestions. I'll give them a read through!

One other thing that you may be able to help me with is how to tell Form2
that Form1 is its parent. Thinking about my problem today, I think this is
the problem i.e. Form2 doesn't know that Form1 is the parent. If it did, I
think my original code would work. Do you have any suggestions on how I
could do it? When I tried:

frm.Parent = Me

I got an exception :(

Hope you can help me further.

Geoff
 

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