473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hello sharpyC

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
2 1212
bartonc
6,596 Expert 4TB
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
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

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
24
by: Andy Sutorius | last post by:
Has anyone successfully created a Hello World program without using Visual Studio.NET? If so, what IDE did you use and what namespaces did you import? Thanks! Andy Sutorius
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
5
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
10
by: fei.liu | last post by:
Consider the following sample code char * ptr = "hello"; char carray = "hello"; int main(void){ } What does the standard have to say about the storage requirement about ptr and carray? Is...
4
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
0
by: devito | last post by:
hi there, for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file like the following: // --- snip...
0
Nepomuk
by: Nepomuk | last post by:
Hi everybody! As was suggested here, today should be Hello World Day! So, here's my Hello World Program in bash script: #!/bin/bash i=0; function hello { case $i in 0) echo 'H' i=`expr...
0
by: tosreejithp | last post by:
Hi, My first problem was i am not able to compiled a file from java script to java class.Now its clear and working fine..now i can convert a java script file to java class by Rhino Java Script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.