|
 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |

April 9th, 2013, 09:49 PM
|
Registered User
|
|
Join Date: Apr 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Basic addition button
I am new to programming in general but not IT. I understand pseudo code and I think that I understand the logic behind programming, but have not really written code before. I have worked all the way upto chapter 16 so far, but I am still struggling with the basics. I have gone back and reread chapter 5 since this is the cahpter on programming asp.net pages. I am trying to create a page that has 2 input fields (textboxes) and 4 buttons add subtract mult and div. with a result label.
I have been looking at this problem for 2 days and I am stumped. I have written it 12 different ways but I cannot get the code to work and now I have totally confused myself! Please any help is appreciated! 
|

April 10th, 2013, 02:20 AM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
Hi there,
Can you post your current code as well as a description of what you're having problems with?
If you post code, can you please paste it in Notepad first to remove color coding and then use the forum editor's Code toolbar button to wrap your code in code tags. Otherwise, this forum messes up the code.
Cheers,
Imar
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

April 10th, 2013, 09:02 PM
|
Registered User
|
|
Join Date: Apr 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Basic addition code
Imar,
Thanks for the reply, i actually was able to get it resolved; however I am sure that I will need some more guidance in the the future. Below is the code that I am using for the button. By the way I like your book, I think that you have written it well. As I stated I am new to all programming except for a tiny amount of PHP and desk checking. I have learned a lot so far.
Code:
Protected Sub btnAdd_Click(sender As Object, e As System.EventArgs) Handles btnAdd.Click
Dim excalc As New CalculatorASS2()
Dim value1 As Integer = Convert.ToDouble(valueBox1.Text)
Dim value2 As Integer = Convert.ToDouble(valueBox2.Text)
Dim result As Integer = excalc.add(value1, value2)
Label5.Text = result
' this is my public class
Public Class CalculatorASS2
Public Function add(ByVal a As Double, ByVal b As Double) As Double
Return a + b
End Function
Public Function Subtract(ByVal a As Double, ByVal b As Double) As Double
Return a - b
End Function
Public Function Multipy(ByVal a As Double, ByVal b As Double) As Double
Return a * b
End Function
Public Function Divide(ByVal a As Double, ByVal b As Double) As Double
Return a / b
End Function
Public Function Exponent(ByVal a As Double, ByVal b As Double) As Double
Return a ^ b
End Function
End Class
Last edited by Headstrong2112; April 10th, 2013 at 09:08 PM..
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
All times are GMT -4. The time now is 01:47 AM.
|