Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Addition

Posted on 2004-04-18
6
Medium Priority
?
204 Views
Last Modified: 2010-05-02
I would like to know the formatting on the addition of two labels that are numbers.

curPartsandTax1 = Val(txtPartsCharge1.Text) * 1.08
    curLaborHours1 = Val(txtLaborHours1.Text) * 30                        Example
    lblPartsandTax1.Caption = FormatNumber(curPartsandTax1, 2)   59.99
    lblLaborDollars1.Caption = FormatNumber(curLaborHours1, 2)    1,374.00
    lblJobTotal1.Caption = FormatNumber(curPartsandTax1, 2) _
    + FormatNumber(curLaborHours1, 2)                                         59.991,374.00  ???
   
0
Comment
Question by:gonzal13
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10855012
lblJobTotal1.Caption = FormatNumber(curPartsandTax1, 2)  + FormatNumber(curLaborHours1, 2)

The FormatNumber() function returns a String object, and the "+" operator means Concatenation for Strings, so try this instead:

lblJobTotal1.Caption = FormatNumber(curPartsandTax1 + curLaborHours1, 2)

Regards,

Idle_Mind
0
 
LVL 13

Author Comment

by:gonzal13
ID: 10954815
Please close out this question

gonzal13(Joe)
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 150 total points
ID: 10959389
Did my solution work gonzal13?

If not, please explain the problem further or post your own solution and request a refund.  

Idle_Mind
0
 
LVL 13

Author Comment

by:gonzal13
ID: 10961616
I had not looked at this site since I had posted another question that helped me get started on the project.

This is the final code:

'Maintain a list box.
'Use dropdown combo box
'Use command Buttons



Private Sub cboClear_Click()

    'The list is named cboCombo1
    'The command clears the Combo1 list
   
    cboCombo1.Clear
   
End Sub

Private Sub cboCombo1_Change()

End Sub

Private Sub cboCount_Click()

    'The ListCount command is used with the message box
    'to view the number of lines in the list
   
    MsgBox "The number of Types is " & cboCombo1.ListCount
End Sub

Private Sub cboPrint_Click()

    'The ListCount returns the number of items in a list
    'If no item is selected, the ListIndex is set to -1.
    'The first item in the list is ListIndex 0 and ListCount
    'is always one more than the largest List Index
    ' Index is a database object that provides access to
    'Data in rows of a table, based on key values.
 
    Dim intIndex As Integer
    Dim intFinalValue As Integer
 
    intFinalValue = cboCombo1.ListCount - 1
    For intIndex = 0 To intFinalValue
    Printer.Print cboCombo1.List(intIndex)
    Next intIndex
    Printer.EndDoc
   
End Sub

    'vbExclamation dislays using the Msb Box a
    'message found in quotes. Usually a warning Message.
    'Private Sub cmdADD_Click()
    '
    'If cboCombo1.Text <> "" Then
    'cboCombo1.AddItem cboCombo1
   
    'Else
    'MsgBox "Blank data", vbExclamation, "Error"
    'End If
    'End Sub


Private Sub cmdExit_Click()

    End
   
End Sub

Private Sub cmdRemove_Click()

   'A combo box control combining the features of a text box
   'and list box.
   'This control allows the user to select an item either
   'by typing into a ComboBox or by selecting it from a list.
   'Remove an item from a ListBox or Combo Box.
   'object.RemoveItem.Index
   'vbInformation Display information using a combo box
   
   If cboCombo1.ListIndex <> -1 Then
    cboCombo1.RemoveItem cboCombo1.ListIndex
    Else
        MsgBox " First select Item to remove", vbInformation, _
        "No Selection made"
   
    End If
   
End Sub

Private Sub cmdSort_Click(Index As Integer)

    'Take the combo box list, name the row and sort

    cboCombo1.Recordset.sort = "bagles"
   
End Sub


'Private Sub mnuADD_Click()

'End Sub
'Private Sub mnuFile_Click()

'End Sub
Private Sub Form_Load()

End Sub


gonzal13(Joe)
0
 
LVL 13

Author Comment

by:gonzal13
ID: 11026175
I would like to close this question out. I klnow all of you had spent time in helping me. Before I looked at any of your comments, I found the answer in the text book. I have 2000 points and would gladly give someone the points, but there are so man notes, that I do not think it is fare to award points to any one person.

Sincerely

gonzal13(Joe)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question