Hi, I am a beginner for Visual Studio C# 2008. Currently, I am creating the program which requires me to have user input in one User Control item and this data is needed to be passed on to another User Control for arithmetic manipulation.
My first User Control is called Structure_Data. I will be getting input values from the textboxes named LengthB_txt
, WidthB_txt
and HeightB_txt
.
These value inputs in the textboxes above will be accessed in a new UserControl
called CollectionArea
.
I do not know how to connect the User controls as well as to access the data. In my User Control: Collection Area, to make my final result appear in the Ad_txt
textbox, I did the following codes. However, I got error :
'WindowsFormsApplication1.Structure_Data.LengthB_txt' is inaccessible due to its protection level
Please help me. I am stuck! =( Thanks...
private void Ad_txt_TextChanged(object sender, EventArgs e)
{
// const double PI = 3.14159265;
double Lb;
double Wb;
double Hb;
// Get the input value for Dimensions: Length
Lb = Convert.ToDouble(StructDataPass.LengthB_txt.Text);
Wb = Convert.ToDouble(StructDataPass.WidthB_txt.Text);
Hb = Convert.ToDouble(StructDataPass.HeightB_txt.Text);
double Ad_temp=0;
double result_temp1=0;
result_temp1 = Math.Pow(3 * Hb, 2);
Ad_temp = Lb*Wb*6*Hb*(Lb+Wb)+(Math.PI)*result_temp1;
Ad_txt.Text = Convert.ToString(Ad_temp);
}