473,761 Members | 10,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centering Dialog Form on Parent

I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter
Nov 21 '05 #1
7 4634
How is anyone going to be able to move frmMain if frmUpdating (your dialog
form) is being show modally? Or am I missing something ?

Imran.

"Peter" <pe***@mclinn.c om> wrote in message
news:dc******** *************** ***@posting.goo gle.com...
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #2
Set StartPosition property of the form.

"Peter" wrote:
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #3
Peter,
As Imran asks, is the UpdatingForm (frmUpdating) displayed with Form.Show or
Form.ShowDialog ?

If you are using Form.Show, then you should be able to handle the Form.Move
& Form.Resize to manually move & resize your UpdatingForm.

If you are using Form.ShowDialog , then as Imran states, the user cannot move
your MainForm (frmMain).

FWIW: A "Dialog Form" implies to me that you are using Form.ShowDialog .

Hope this helps
Jay
"Peter" <pe***@mclinn.c om> wrote in message
news:dc******** *************** ***@posting.goo gle.com...
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #4
"Peter" <pe***@mclinn.c om> schrieb:
I have a primary form named frmMain. During some extended
data pulls I launch another Dialog Form named frmUpdating.
[A little progress meter shows up and scrolls across the
screen why the data is being pulled.] How do I keep the
frmUpdating centered on the frmMain if a user moves the
frmMain form?


Are you showing the dialog form modally? Then the user will not be able to
move the main form at all. Otherwise add a handler to the main form's
'Move' event and place the code for positioning the dialog there.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #5
Peter,

Sorry, however in my opinion makes what you ask not so much sense.

I think that it is easier to use instead of a dialog form a panel what
starts invisible and when you need it make it visible. That panel has of
course to lay on top of the other controls.

Using the Dock property of the panel and setting that to dockstyle.fill
makes this even very easy.

The user does really not see it if you use a panel or a form.

I hope this gives an idea? (it really moves in the center of your form)

And when I see something wrong don't hesitate to reply.

Cor

"Peter" <
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #6
I've added for frmUpdating in the designer and then call on the
frmUpdating.sho wDialog using a new thread:

IE.

This is in the frmMain:
Shared Sub RunUpdate(ByVal stateinfo As Object)
Dim frm_Update As New frmUpdating
frm_Update.Show Dialog()

End Sub

Then when I want my updaing to launch I do this:

ThreadPool.Queu eUserWorkItem(A ddressOf RunUpdate) 'Opens up the
frmUpdating

that runs until a global named StopNow = False 'I place this code
after my main proceedures run.

So basically the updating bar is more to just let the user know that
the data process is still running. The problem though is that because
these two forms are running on different threads that if a user moves
the form then the updating display is off center.

-Peter
Nov 21 '05 #7
Peter,

Because of all the other answers which are given in this thread, what is the
sense of a showdialogform with a multithreading operation. Your main
operation is freezen anyway.

Not everybody agrees this with me, however in my opinion when the user
cannot do anything in between and has to wait on the result of the
operation, than just let an avi or a animated gif go in your application in
the same way as microsoft does that.

The multithreading will only give you overhead.

Some of those AVI's you can find in
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Gr aphics\videos

They are not supported for nothing.

However just my idea

Cor
"Peter" <pe***@mclinn.c om>
I've added for frmUpdating in the designer and then call on the
frmUpdating.sho wDialog using a new thread:

IE.

This is in the frmMain:
Shared Sub RunUpdate(ByVal stateinfo As Object)
Dim frm_Update As New frmUpdating
frm_Update.Show Dialog()

End Sub

Then when I want my updaing to launch I do this:

ThreadPool.Queu eUserWorkItem(A ddressOf RunUpdate) 'Opens up the
frmUpdating

that runs until a global named StopNow = False 'I place this code
after my main proceedures run.

So basically the updating bar is more to just let the user know that
the data process is still running. The problem though is that because
these two forms are running on different threads that if a user moves
the form then the updating display is off center.

-Peter

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4751
by: Dalan | last post by:
I designed a dialog box with a combo to select individual vendors from a form and its related data for print ouput. Though the dialog box seems to work okay, I apparently do not have the filtering code behind the OnOpen Event Procedure of the report structured correctly. Anyone's assistance will be appreciated, although I would like to stay on the same track. Here is what I have done: 1. Created a new vendor query (qryVendorRpt) with...
2
1832
by: Roger | last post by:
form A has a command button that opens form B in dialog mode DoCmd.openForm "frmProductPrice", acNormal, , , acFormEdit, acDialog, productId form B is a tabular form with 3 'required' fields I can enter data in the three fields and save them - no problem Once I dirty a record in the dialog form, I get the little 'pencil' in
3
11878
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a to-be-developed-function cmdOkay_Click() function as described below. 1. Create an user control that contains an OK button as below Public Class MyButton:System.Windows.Form.UserControl
14
3771
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
3
2240
by: ApexData | last post by:
I have a Dialog PopUp Form that is called by the following code: DoCmd.OpenForm stDocName, , , stLinkCriteria, cFormReadOnly, acDialog I would like to set the Visible propery of a Label in this form after the call is made. How can I do this ??? I tried the following code, but I get "Cant Find Field" Error. I also noticed that error occurs after the PopUp Form is released, suggesting that my second line of code is not running until...
0
1740
by: ashishyadav2007 | last post by:
In Setup project for .net I have added a dialog(form) between Start and End dialog(form), but i need to show that dialog(form) only if a registry search condition is successful. If registry search condition fails I dont want to show that dialog(form) during installation process. How can I do that -- i mean how can i apply launch condition to a dialog(form) in the setup project?
7
2919
by: Sin Jeong-hun | last post by:
I have a dialog form which pops up from the main window using the ShowDialog() method. this dialog has no or button, and it has quite a lot of controls on it. Now, I want to close this dialog form when the user presses the escape key, but that's only when no control on the form is responsible for the escape key. For example, it has a ComboBox control, and a user can press the escape key just to close the drop down list that is being...
3
4946
pradeepjain
by: pradeepjain | last post by:
hii.. i use cope like this <td><a href='/login.php' id="view-user" >Pradeep</a></td> and defauly jquery dialog code <script type="text/javascript"> $(function() { $("#dialog").dialog("destroy"); $("#dialog-form").dialog({
1
2060
by: Tim Mullin | last post by:
Hello all, I have a problem that probably has a simple solution but I just can't seem to figure it out. I have a form (QueryScreen)that has a button that opens another form (StateSearch) in dialog mode. On the dialog form there is a list box with a list of states and a button that runs a query to return customers that are located in the selected state. After running the query, the query appears immediately in a new tab - but the dialog...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.