Results 1 to 7 of 7

Thread: need urgent help simply syntax error!!!!!!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    4

    need urgent help simply syntax error!!!!!!!!

    hi i am trying to currently make a program that has 3 text boxes, you enter the make and model of the car as well as montly rate for payments but i cant run the program with out getting an error, i dont have visual basic on this as i am on linux i do however have the form so here it is
    Code:
    VERSION 5.00
    
    Begin VB.Form lblrate 
    
       Caption         =   "car hire"
    
       ClientHeight    =   6885
    
       ClientLeft      =   60
    
       ClientTop       =   345
    
       ClientWidth     =   4680
    
       LinkTopic       =   "Form1"
    
       ScaleHeight     =   6885
    
       ScaleWidth      =   4680
    
       StartUpPosition =   3  'Windows Default
    
       Begin VB.CommandButton cmdclear 
    
          Caption         =   "Clear"
    
          Height          =   615
    
          Left            =   3960
    
          TabIndex        =   13
    
          Top             =   1440
    
          Width           =   615
    
       End
    
       Begin VB.CommandButton cmdok 
    
          Caption         =   "OK"
    
          Height          =   615
    
          Left            =   3960
    
          TabIndex        =   12
    
          Top             =   600
    
          Width           =   615
    
       End
    
       Begin VB.TextBox list2 
    
          Height          =   3135
    
          Left            =   2160
    
          TabIndex        =   8
    
          Top             =   3000
    
          Width           =   1215
    
       End
    
       Begin VB.TextBox list1 
    
          Height          =   3135
    
          Left            =   600
    
          TabIndex        =   7
    
          Top             =   3000
    
          Width           =   1215
    
       End
    
       Begin VB.TextBox txtrate 
    
          Height          =   495
    
          Left            =   2280
    
          TabIndex        =   6
    
          Top             =   1800
    
          Width           =   1455
    
       End
    
       Begin VB.TextBox txtmodel 
    
          Height          =   495
    
          Left            =   2280
    
          TabIndex        =   5
    
          Top             =   1200
    
          Width           =   1455
    
       End
    
       Begin VB.TextBox txtmake 
    
          Height          =   495
    
          Left            =   2280
    
          TabIndex        =   4
    
          Top             =   600
    
          Width           =   1455
    
       End
    
       Begin VB.Label lblfooter 
    
          Height          =   255
    
          Left            =   360
    
          TabIndex        =   11
    
          Top             =   6600
    
          Width           =   4095
    
       End
    
       Begin VB.Label lblcharge 
    
          Caption         =   "Charge (£)"
    
          Height          =   255
    
          Left            =   2280
    
          TabIndex        =   10
    
          Top             =   2640
    
          Width           =   1095
    
       End
    
       Begin VB.Label lbldays 
    
          Caption         =   "Days"
    
          Height          =   255
    
          Left            =   600
    
          TabIndex        =   9
    
          Top             =   2640
    
          Width           =   1095
    
       End
    
       Begin VB.Label lblrate 
    
          Caption         =   "Enter daily rate:"
    
          Height          =   375
    
          Left            =   120
    
          TabIndex        =   3
    
          Top             =   1800
    
          Width           =   1695
    
       End
    
       Begin VB.Label lblmodel 
    
          Caption         =   "Enter model of car:"
    
          Height          =   375
    
          Left            =   120
    
          TabIndex        =   2
    
          Top             =   1200
    
          Width           =   1695
    
       End
    
       Begin VB.Label lblmake 
    
          Caption         =   "Enter make of car:"
    
          Height          =   375
    
          Left            =   120
    
          TabIndex        =   1
    
          Top             =   600
    
          Width           =   1695
    
       End
    
       Begin VB.Label lbltitle 
    
          Caption         =   "CHERAIR CAR HIRE COMPANY"
    
          Height          =   375
    
          Left            =   120
    
          TabIndex        =   0
    
          Top             =   0
    
          Width           =   3975
    
       End
    
    End
    
    Attribute VB_Name = "lblrate"
    
    Attribute VB_GlobalNameSpace = False
    
    Attribute VB_Creatable = False
    
    Attribute VB_PredeclaredId = True
    
    Attribute VB_Exposed = False
    
    Private Sub cmdclear_Click()
    
    txtmake = ""
    
    txtmodel = ""
    
    txtrate = ""
    
    End Sub
    
    
    
    Private Sub cmdok_Click()
    
    If txtmake.Text = "ford" Then lblfooter.Caption = "YOU GET A FREE ROAD ATLAS WITH THIS HIRE"
    
    Dim counter As Integer
    
    For counter = 1 To 14
    
    list1.AddItem (counter)
    
    list2.AddItem (Format(counter * Val(txtrate.Text), "currency"))
    
    Next
    
    End Sub
    
    
    
    Private Sub Form_Load()
    
    
    
    End Sub
    can anyone see an error in the syntax there?
    thanks for reading and i hope you can help

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    4

    Re: need urgent help simply syntax error!!!!!!!!

    no this is for school, i cant open the project file on linux so i opened the form in text editor
    there is an error in there somewhere i just dont know where

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: need urgent help simply syntax error!!!!!!!!

    when you run the project /form in vb it will indicate where the error is

    no syntax error here

    list1.additem (counter)
    will not work as your list1 is a textbox and there is no additem method for a text box, you need to replace with a listbox
    same for list2
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    4

    Re: need urgent help simply syntax error!!!!!!!!

    ok so the problem is im using textboxes for list 1 and 2 where i should be using list boxes ? can you show me a image of the list box tool/ button please
    many thanks

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: need urgent help simply syntax error!!!!!!!!

    See attached image.
    Attached Images Attached Images  

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    4

    Re: need urgent help simply syntax error!!!!!!!!

    thanks
    and your avatar is wrong, a penguin is much harder than the .net frame work seing as the penguin has mad open source skillz

Posting Permissions

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



Click Here to Expand Forum to Full Width