I am trying to get a text value from NameForm and pull it in Welcome as a label value.
What I have so far, when the Welcome page comes up, it does not give the value of the text but if you click on the label field, it pops up with the NameForm screen. After you enter name again on the NameForm screen, it will show in Welcome.

Screens should be:

NameForm - enter name and click submit to go to Welcome.
Welcome - this has a label field in it that should populate with the name that was entered on the NameForm.

public partial class NameForm : Form
    {
        private string fullname = " ";

        public string nameValue
        { get { return fullname; } }
.......
        public void SubNameBtn_Click(object sender, EventArgs e)
        {            
            this.AcceptButton = SubNameBtn;   

            User user = new User();

            user.FirstName = fNameTxt.Text;
            user.LastName = lNameTxt.Text;

            fullname = fNameTxt.Text;    \\using only fNameTxt till figured out
.........
public partial class Welcome : Form
    {
        public Welcome()
        {
            InitializeComponent();
            CenterToScreen();
        }

        private void WelNameLbl_Click(object sender, EventArgs e)
        {
            NameForm frm = new NameForm();
            
            WelNameLbl.Text = frm.nameValue;
            frm.Show();
        }

Hey

I recently had a problem like this.
I found a site about it but I can't find it now.

So basically I passed the main form as an argument to the login form.
Like this:

public int a = 100;
        public Mainform() { // I created the loginform in Mainform
        LoginForm Name = new LoginForm(this);  //And pass the Mainform as an argument
        }

This is the loginForm

Mainform parent;
        public LoginForm(Mainform parentform) {
        InitializeComponent();
        this.parent = parentform;
        }

Now you can call items in the Mainform if they are public.
Like this:

parent.a = 0;

hi,
i think this trick may help you
First create a public function in second form and with parameters,which lake the value from first form and set the value to secon form.
http://infynet.wordpress.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.