By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,415 Members | 1,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,415 IT Pros & Developers. It's quick & easy.

Hello sharpyC

P: 2
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...

Expand|Select|Wrap|Line Numbers
  1. public static double returnCubeMe(double y)
  2.         {
  3.             return (y * y * y);
  4.         }
  5.  
  6.         public static string returnSomething()
  7.         {
  8.             return "I'm static";
  9.         }
  10.  
  11.         public void ChangeByVal (int intPassByVal)
  12.         {
  13.  
  14.         }
  15.  
  16.  
  17.         [STAThread]
  18.         static void Main() 
  19.         {
  20.             Application.Run(new Form1());
  21.         }
  22.  
  23.         private void btnHi_Click(object sender, System.EventArgs e)
  24.         {
  25.             // erase textbox after btnHi is clicked
  26.             this.txtHi.Text = "";
  27.         }
  28.  
  29.         private void btnCube_Click(object sender, System.EventArgs e)
  30.         {
  31.             // take the number in txtCube and cube it
  32.             this.txtCube.Text = System.Convert.ToString(
  33.                 System.Convert.ToInt16(this.txtCube.Text) * 
  34.                 System.Convert.ToInt16(this.txtCube.Text) *
  35.                 System.Convert.ToInt16(this.txtCube.Text));
  36.         }
  37.  
  38.         private void btnCube2_Click(object sender, System.EventArgs e)
  39.         {
  40.             // take the double in txtCube2 and cube it
  41.             txtCube2.Text = returnCubeMe();
  42.         }
  43.  
  44.         private void btnStatic_Click(object sender, System.EventArgs e)
  45.         {
  46.             txtStatic.Text = returnSomething();
  47.         }
  48.  
  49.         private void btnVal_Click(object sender, System.EventArgs e)
  50.         {
  51.  
  52.         }
  53.  
  54.         private void btnRef_Click(object sender, System.EventArgs e)
  55.         {
  56.  
  57.         }
  58.     }
  59. }
Feb 18 '07 #1
Share this Question
Share on Google+
2 Replies


bartonc
Expert 5K+
P: 6,596
Hello and welcome to TheScripts.com. I'm not sure if this should go to the .NET forum or the C++/C forum. Post back and I'll move it where ever you think is best.
Feb 18 '07 #2

P: 2
Hello, it can go wherever I would get the quickest help!!! Just kidding, it probably should go into the C++/C# section. Thanks.
Feb 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.