|
-
Nov 8th, 2004, 05:02 PM
#1
Thread Starter
Addicted Member
resolved
i have a new project, its like this...
i have a main form, that is all menu driven. i do this
VB Code:
Private Sub mnuFileNewCharter_Click()
'Brings up the NewCharter Form.
frmNewCharter.Show vbModeless
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.
-
Nov 8th, 2004, 05:13 PM
#2
Fanatic Member
Are we on the right track for you?
VB Code:
Private Sub Command1_Click()
Text1.Text = Val(Text1.Text * List1.Text)
MsgBox Text1.Text * List1.Text, vbInformation
End Sub
Private Sub Form_Load()
List1.AddItem "22"
List1.AddItem "24"
-
Nov 8th, 2004, 05:19 PM
#3
Frenzied Member
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.
-
Nov 8th, 2004, 07:26 PM
#4
Thread Starter
Addicted Member
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:
intHours.Text = val(txtHours.Text )
intCalc = (intHours* 'Whatever is selected in the list)
msgbox intCalc, vbOKOnly
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
-
Nov 8th, 2004, 07:35 PM
#5
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.
-
Nov 8th, 2004, 09:33 PM
#6
Thread Starter
Addicted Member
(resolved)
check it out now
VB Code:
If lstSize.Text = "22" Then
gintTotal = intHoursChartered * 95
End If
lblTotal.Caption = FormatCurrency(gintTotal)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|