Caculation

Can anyone show a newbie how this works? I tried doing it myself but I seem to keep getting errors and the book I'm using is not so helpful.

For example, I want to calcuate the gallon of paint (Length + Width) times 2 times 10 feet height and divide it all by 300.

My understanding is you have to start it off by "Dim" correct? Can anyone show me how this works?

Thanks-Young

Comments

  • Hi Young, yes this Dim you speak of is the way in which you declare variables. You do Dim As . You can then assign values to these variables and perform calculations on them. For instance your code would need to be something like (but more added):

    [code]
    Dim intWidth as Integer
    Dim intHeight as Integer
    Dim intResult as Integer

    IntWidth = 50
    IntHeight = 100
    IntResult = (IntWidth * IntResult) / 2

    MsgBox(IntResult)

    [/code]

    This would display a message simply saying 2500.
    For more on variables take a look at:
    http://visualbasic.about.com/od/quicktips/qt/vardeclare.htm
    And any other beginner sites for VB.NET

    HTH, Dai


    ------------------------------------------
    Do or do not, there is no try. |
    ------------------------------------------
  • I tried the int and it kept giving me error, what am I doing wrong?

    Thanks-Young
  • Try changing it to double.

    D


    ------------------------------------------
    Do or do not, there is no try. |
    ------------------------------------------
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories