I am new to these forums and message boards, but I am trying to do a C# windows application Lab and cannot get the code correct for the button's click event which will Cube a "double" number entered into an adjacent textbox. Also, another textbox is supposed to return the pass by Val and pass by Ref results when either Button1 or Button2 is clicked below it. I thought I could code the double like I did the previous int textbox and just change a couple of words, but it's not working. If there is anyway I could get an answer today, that would be great!!!
Here is the code I have so far...
public
staticdouble returnCubeMe(double y)
{
return (y * y * y);
}
public static string returnSomething()
{
return "I'm static";
}
public void ChangeByVal (int intPassByVal)
{
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void btnHi_Click(object sender, System.EventArgs e)
{
// erase textbox after btnHi is clicked
this.txtHi.Text = "";
}
private void btnCube_Click(object sender, System.EventArgs e)
{
// take the number in txtCube and cube it
this.txtCube.Text = System.Convert.ToString(
System.Convert.ToInt16(this.txtCube.Text) *
System.Convert.ToInt16(this.txtCube.Text) *
System.Convert.ToInt16(this.txtCube.Text));
}
private void btnCube2_Click(object sender, System.EventArgs e)
{
// take the double in txtCube2 and cube it
txtCube2.Text = returnCubeMe();
}
private void btnStatic_Click(object sender, System.EventArgs e)
{
txtStatic.Text = returnSomething();
}
private void btnVal_Click(object sender, System.EventArgs e)
{
}
private void btnRef_Click(object sender, System.EventArgs e)
{
}
}
}