Results 1 to 6 of 6

Thread: resolved

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    youngstown, oh
    Posts
    202

    Resolved resolved

    i have a new project, its like this...
    i have a main form, that is all menu driven. i do this
    VB Code:
    1. Private Sub mnuFileNewCharter_Click()
    2. 'Brings  up the NewCharter Form.
    3.  
    4. frmNewCharter.Show vbModeless
    5. End Sub
    ...and that bring me to my NewCharter form. there i have 1 txt box that for the 'Responsible Party:' for their name. and another txtbox for 'Hours Chartered".
    i have a list box that is for "Size" in the list box is the values 22,24,30,32,36,38,45. and then i have a combo box, which is "Yacht TypE". what i need to do is have the value in the Hours Charted box, multiplied by what value is selcected from the "size" list box. but the thing is depending on the size, i need it to be mulitpled by somethin specific.
    22-95
    24-137
    30-160
    32-192
    36-250
    38-400
    45-550
    let me know if you cant help. it would be apperciated. -justin
    Last edited by jlbovo; Nov 8th, 2004 at 10:16 PM.

  2. #2
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    Are we on the right track for you?
    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3. Text1.Text = Val(Text1.Text * List1.Text)
    4.  
    5. MsgBox Text1.Text * List1.Text, vbInformation
    6. End Sub
    7.  
    8. Private Sub Form_Load()
    9. List1.AddItem "22"
    10. List1.AddItem "24"

  3. #3
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    You can hardcode the values into an Array, so 22 = 95, or to make it easier to maintain, you can create a text file and have your application read it in as an Array, like 22,95 or 22=95 and just split on the delimter.

    Then you can multiply it easily by the value and also be able to update it very quickly if the prices change.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    youngstown, oh
    Posts
    202
    Private Sub Command1_Click()

    Text1.Text = Val(Text1.Text * List1.Text)

    MsgBox Text1.Text * List1.Text, vbInformation
    End Sub
    ......would look like this for me


    VB Code:
    1. intHours.Text = val(txtHours.Text )
    2. intCalc = (intHours* 'Whatever is selected in the list)
    3. msgbox intCalc, vbOKOnly
    4. end sub
    You can hardcode the values into an Array, so 22 = 95, or to make it easier to maintain, you can create a text file and have your application read it in as an Array, like 22,95 or 22=95 and just split on the delimter.
    ....im not sure what that means, but does anyones else know what i am gettin at ?

    i need to assign those values to the values on the list, and i have no clue on how to do that, please please help ! thank u - justin

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    sizecalc(22) = 95
    then you could use the VALUE of the selection
    intHours * sizecalc(selectedvalue)
    to multiply by 95

    if intHours is a variable (and not a textbox) then you don't need to assign it to intHours.text. Just use intHours.

    prolly easier to use this:

    Code:
     x = 23
     Select Case x
       Case 22 To 23
         MsgBox "95"
      case 24 To 29
         MsgBox "137"
      End Select
    no need for an array
    Last edited by dglienna; Nov 8th, 2004 at 07:45 PM.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    youngstown, oh
    Posts
    202

    Resolved (resolved)

    check it out now
    VB Code:
    1. If lstSize.Text = "22" Then
    2.     gintTotal = intHoursChartered * 95
    3. End If
    4. lblTotal.Caption = FormatCurrency(gintTotal)
    5. End Sub
    now if i make an if/nested if statement for eveything is the list i am golden. im gonna resolve this one, cos i have a printer prob next...
    Last edited by jlbovo; Nov 8th, 2004 at 10:13 PM.

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