473,624 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# WinApp : Open Forms in Multiple screen

Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Hi All,
i Have an application functionaluty which has 4 forms which are needed to interact by the user by dragging data from these forms to one another
the main form is located in the MDI Parent and the rest are on their respective screen (3 other secondry screens)

At the moment i am testing using 2 screens but i get a very similar behavious when i run it on a 4 screened system.

For the 2 screen system:
form1 opens in primary screen (ie the MDI Parent)
form2 opens in 2nd screen
form3 opens in 1st screen (primary)
form 4opens in 2nd screen

for the 4 screened system:
form1 opens in primary screen (ie the MDI Parent)
form2 opens in 2nd screen
form3 opens in 1st screen (primary)
form 4opens in 2nd screen

When this feature is requested by the user, form1 opens
form1 has the following code which opens form2, form3, and form4 in their respective screens

following is the code in method called by form_load within form1

Expand|Select|Wrap|Line Numbers
  1. private void openForms()
  2. {
  3.    Form2 form2 = new Form2();
  4.    Form3 form3 = new Form3();
  5.    Form4 form4 = new Form4();
  6.  
  7.    Screen[] screens = Screens.AllScreens;
  8.    if(screens.Length == 2)
  9.    {
  10.       List<Screen> lstScreen = new List<Screen>();
  11.       foreach(Screen screen in Screen.AllScreens)
  12.       {
  13.          if(screen.Primary == false)
  14.             lstScree.Add(screen);
  15.       }
  16.       form2.Location = lstScreen[0].WorkingArea.Location;
  17.       form3.Location = lstScreen[0].WorkingArea.Location;
  18.       form4.Location = lstScreen[0].WorkingArea.Location;
  19.    }
  20.    else if(screens.Length == 4)
  21.    {
  22.       List<Screen> lstScreen = new List<Screen>();
  23.       foreach(Screen screen in Screen.AllScreens)
  24.       {
  25.          if(screen.Primary == false)
  26.             lstScree.Add(screen);
  27.       }
  28.       form2.Location = lstScreen[0].WorkingArea.Location;
  29.       form3.Location = lstScreen[1].WorkingArea.Location;
  30.       form4.Location = lstScreen[2].WorkingArea.Location;
  31.    }
  32. }
While debugging it for the 2 screen system, i found that the Location of all the 3 forms is being set to -1280,0 even after the show method is executed the positions are shown to -1280,0

so cant figure out why form3 appears on the primary screen, but form4 appears back onto the 2nd screen.

Any help is appreciated, Thankyou

-Shashi
Jan 10 '08 #1
0 4568

Sign in to post your reply or Sign up for a free account.

Similar topics

55
4645
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's not obvious how the code works if you don't know the intricacies of the Property Let/Get syntax. Likewise, I dislike (and code to minimize the use of) the VB/VBA syntax of returning a value by referring to the function name as if it were a...
3
1833
by: Hp | last post by:
Hello, Is it possible to have more than one record from the same table open on the screen using forms? If you have an contact list for example and want to check a phone number whilst editing an adress. How would that be coded? Thanx for help
13
3339
by: Ole Hanson | last post by:
Hi I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P). This functionality should be present "out of the box" after the app (app.exe) is deployed on the Client's PC. The only way I know - is to place a shortcut on the desktop and associate a "ShortCut Key" to it by right-clicking on the shorcut on the desktop. Now - how do I, do that during installation using Windows...
4
9905
by: Scott Johnson | last post by:
Hi! Is there a way to "preload" a form using a thread or something else so that my user doesn't have to wait 5 seconds (initializing time) between forms? Some of these forms have tab strips with lots of controls and database queries on them and I would like to try to have some(all) of the preloading of the next form and controls done in the background while a user is still entering data. (For example, my user visits screen A then B then...
2
1833
by: John | last post by:
Hi I am opening a dialog using; frmdialog = New frmdialognew frmdialog.ShowDialog() Is there a way to see if this dialog is already open to avoid opening multiple instances of it?
3
5929
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it. This code works well for splash screen. I searched alot on net for codes but they don't work. for example- (1) Public Sub CloseForm(formType As System.Type) For Each oForm as System.Windows.Forms.Form in me.MdiParent.MdiChildren If...
6
2642
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. so far I have built a traditional app, switchboard, forms, etc. Part of this app is to automate the forms they previously prepared manually. After the app was built and works just fine, I find out there are several case managers using MS word...
0
1467
nev
by: nev | last post by:
I know when is best to use some templates but listed below are most that I don't know when is best to use or even know how to use: I am creating a windows application with mysql backend. 1. Windows Form - I use this mostly to create my windows forms 2. Dialog - I use this for windows that need user intervention 3. Explorer Form - maybe I will use this if I plan to make something like windows explorer 4. MDI Parent Form - I also use this...
4
1573
by: =?Utf-8?B?MjJQb20=?= | last post by:
Hi All, This is all new to me so please be patient with me. What I have is a very large 'Al-In-One' program, not yet complete, that has over 70 Forms/Modules/Classes in it and needs to be broken up into smaller programs/modules that can be called from the main program. I understand that I would need to, via a Click Button to close one part down and open the new section, but how.
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
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
8614
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...
0
8471
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
7153
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...
0
4075
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
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.