Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2013, 09:49 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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!
 
Old April 10th, 2013, 02:20 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Headstrong2112 (April 10th, 2013)
 
Old April 10th, 2013, 09:02 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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..




Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual basic activate a button on a web page tonyau Visual Basic 2010 General Discussion 0 November 25th, 2012 08:15 PM
Visual Basic 2010 - Click a button on a website jd29 .NET 4 and Visual Studio 2010 General Discussions 7 September 28th, 2012 03:27 PM
addition to errata luciano991 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 August 25th, 2006 08:29 PM
basic addition to php Adam H-W Beginning PHP 3 July 10th, 2006 09:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.