Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...!

i have two windows form like Form_A and Form_B! now on Form_A there are ten labels
when user get in Login his name will be display on the label where or on which labels he clicks! it working..! but now what i want when user clicks on the label where his Login name shows, Form_B should be display and when Form_B should be display there will be a text Box..! where i want my LogIn Name..!
so how it works..!

in shortly from 10 labels when i click any label thats label name should be display on Form_B Text Box when it will load!
regards!
Posted

Hi,

On form B, create a property :

C#
public string fieldAValue
{
    get { return tbAValue.Text; }
    set { tbAValue.Text = value; }
}


On form A, populate the property :
C#
using (Form_B frmB = new Form_B())
{
    frmB.fieldAValue = lblFieldAValue.Text;
    if (frmB.ShowDialog(this) == DialogResult.OK)
    {
        // Do stuff here
    }
}

Repeat this for each field you want to pass. If all fields are in som kind of object, you can choose to pass the entire object and/or use DataBinding instead.

Good luck,
Eduard
 
Share this answer
 
Hi,

This article will help you...

Using a delegate to pass data between two forms[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900