Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 16:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Control a Form from another Hidden Form in C#

Discussion on Control a Form from another Hidden Form in C# within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Control a Form from another Hidden Form in C#

I am working on a client that is sending a request to the server to login and if it's accepted the main window shall be hidden and user will start work on the form 2 named user_form ... and there are 3 buttons available for the users on the user_form ( logout - exit - hide )

I want control them all from the main window which is already hidden ,,,

Here is the code I am working with in main form ... but it's not working as I want.

PHP Code:
switch (client.LoginInfo.Limited)
{
    case 
true:
        
this.Hide();
        
User_Form LF = new User_Form(client);
        
LF.AdminControlIsVisible false;
        
DialogResult dr LF.ShowDialog(this);
        if (
dr == System.Windows.Forms.DialogResult.Cancel)
        {
            
//logout
        
}
        else if (
dr == System.Windows.Forms.DialogResult.OK)
        {
            if (
client != null)
            {
                
//hide
            
}
            else
            {
                
UpdateSystemMessage("No response from the server !!");
            }
            return;
        }
        break;
    case 
false:
        
User_Form LF = new User_Form(client);
        
LF.AdminControlIsVisible false;
        
DialogResult dr LF.ShowDialog(this);
        
this.Visible false;
        if (
dr == System.Windows.Forms.DialogResult.Cancel)
        {
            
//logout
        
}
        else if (
dr == System.Windows.Forms.DialogResult.OK)
        {
            if (
client != null)
            {
                
//hide
            
}
            else
            {
                
UpdateSystemMessage("No response from the server !!");
            }
            return;
        }
        break;

I mean that i have 2 forms ( form1, form2 ) i want to hide form1 and show form2 but i need to handle 3 buttons from form2 in the hidden form (form1) i mean ( form 1 control the 3 buttons which is in form2 ) and 2 of those buttons are getting the form1 is shown and close form 2 .. that's all .

Any solution ?
abdeen is offline  
Old 10/10/2014, 22:14   #2
 
elite*gold: 67
Join Date: Aug 2014
Posts: 1,323
Received Thanks: 928
how about WCF?
Xio. is offline  
Old 10/10/2014, 22:24   #3
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by Xio. View Post
how about WCF?
My problem is with windows forms application ...

Well thanks i fixed it and here is the answer :

Form1 Code :

PHP Code:
public void test()
    {
        
this.Hide();
        
Form2 frm2 = new Form2(this);
        
frm2.ShowDialog(this);
    } 
Form2 Code :

PHP Code:
private void button1_Click(object senderEventArgs e)
    {
        
frm.Test(this);
    }

    private 
Form1 MF;

    public 
User_Form(Form _FormClient.State client)
    {
        
this.frm _Form;
        
InitializeComponent();
    } 
Form1 Code :

PHP Code:
public void Test(Form test)
    {
        
test.Hide();
        
this.Show();
    } 
abdeen is offline  
Reply


Similar Threads Similar Threads
[VB.NET] Datensätze von Control auf Form übertragen
09/01/2014 - .NET Languages - 3 Replies
Huhu Ich hab ein kleines Problem, welches ich gerne mit euch teilen möchte. Ich habe auf einem Control ein paar Datensätze von meiner Datenbank hinzugefügt. Als Test möchte ich exakt diese Datensätze (ink. Suchliste und Filter) auf einer Form aufrufen, ohne das ich den Code 2x verwenden muss. Meine Frage ist nun folgende: Gibt es eine Funktion wie ich genau dieses Control einfach "übertragen" kann auf die Form? Eine Allgemeine Formel würde genügen. http://i.imgur.com/SptaYT4.png ...
In one script the 1. form hidden and the 2. show
11/12/2013 - AutoIt - 5 Replies
#thanks :D
Druid Cat Form -> FireLands Cat Form
08/01/2011 - World of Warcraft - 2 Replies
Hallo Leute, hat jemand die Möglichkeiten mir eine Tauren Katze zur Firelands Katze zu swappen - sofern dies in 4.2 FIRELANDS noch möglich ist. Wobei die Vergangenheit uns gelehrt hat, das es immer Mittel und Wege gibt. (: http://manaflask.com/images/galleries/scaled_1307 971939_flamecat.jpg LG Windkirsche



All times are GMT +1. The time now is 16:46.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.