We help IT Professionals succeed at work.
Get Started

Class

ziwez0
ziwez0 asked
on
220 Views
Last Modified: 2010-04-15
Hi, im still getting my head round some of this stuff so please bare with me.

ive got a main form, and inside that form i have a User Control form (which ill call ucSearch)
ucSearch has a dropdownlist and a button which does the following:
private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                UserID = new csUsers();
                UserID.CustomerID = Convert.ToInt32(cboCustomerLastName.SelectedValue);
                MessageBox.Show(UserID.CustomerID.ToString(), "ID of selected client");
            }
            catch
            {
throw;
            }
        }

ive called a class which does the following
public class csUsers
    {
       
        private int xCustomerID;

        public int CustomerID
        {
            get
            {
                return xCustomerID;
            }
            set
            {
                xCustomerID = value;
            }
        }
}
}

but how can i access that value on my main form? i basically want to store this value so lots of other forms can access it, perahps ive done this all wrong, if so please show me the best way to do it.
I just want to be able to get and set the value and easily get access to that value;
thanks
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE