Your Ad Here Your Ad Here
Results 1 to 3 of 3

Thread: Visual Basic

  1. #1
    i am doing an assignment at the moment, i have done the following code in vb6. however when i try to run i get an error message;

    compile error, variable required. cant assign to this expression.

    here is my code;

    Private Sub Command4_Click()

    Dim costpaper As Single
    Dim costpaint As Single
    Dim costdoor As Single
    Dim nodoors As Integer
    Dim norooms As Integer
    Dim w As Integer
    Dim h As Integer
    Dim l As Integer
    Dim area13 As Integer
    Dim area24 As Integer
    Dim areaceiling As Integer
    Dim arearoom As Integer
    Dim totalarea As Integer
    Dim roompainted As Integer
    Dim roompapered As Integer
    Dim totalcostpaint As Single
    Dim totalcostpapered As Single
    Dim totalcostdoors As Single
    Dim subtotal As Single
    Dim VAT As Single
    Dim Total As Single

    norooms = 1
    costofpaint = 8
    costofpaper = 7.5
    costofdoor = 30

    totalarea = 0
    For Count = 0 To norooms
    w = InputBox("Please Enter The Width Of The Room", "Width Of The Room")
    h = InputBox("Please Enter The Height Of The Room", "Height Of The Room")
    l = InputBox("Please Enter The Length Of The Room", "Length Of The Room")

    area13 = 2 * (w * h)
    area24 = 2 * (l * h)
    areaceiling = w * l
    arearoom = area13 + area24 + areaceiling
    totalarea = totalarea + arearoom


    - does anyone have any ideas?

    i have checked the variables are listed. really stuck!!!

  2. Software & Hardware   -   #2
    Join Date
    Jan 2004
    I've never used VB, so I'm probably way off, but does the "costofpaper" variable need to be stored differently, due to the fact it's a decimal?
    On a given day or given circumstance, you think you have a limit.
    And you then go for this limit and you touch this limit and you think "Ok, this is the limit".
    As soon as you touch this limit, something happens and you suddenly can go a little bit further.
    With your mind power, your determination, your instinct and the experience as well, you can fly very high.

    - Ayrton Senna, R.I.P.

  3. Software & Hardware   -   #3
    thanks but its the actual 'for count' thats going wrong. something about the line

    for count = 0 to norooms

    i am cabbaged!!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts