Announcement

Collapse
No announcement yet.

Visual Basic .Net Help Needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Visual Basic .Net Help Needed

    I know some of you guys know programming and I need your help. I just started learning to program and I am stuck.

    Payroll Program

    If there is a loss, the Profit or Loss BackColor is red and its ForeColor is white. If there is a Profit, the BackColor is light-grey and the ForeColor is Black.The Commission BackColor is light-grey and the ForeColor is black.The Calculate button, calculates the Profit or Loss by subtracting the cost from the selling price. Use the FormatCurrency() function to display Profit or Loss. The Commission is calculated by multiply 0.2D times the Profit or Loss. If there is a Loss, the Commission is set to $0.00.Use the FormatCurrency() function to display theCommission. You MUST use a constant which will contain 0.2D.

    I think I got the color change part down. The commission color is the normal color set in design view.

    If (lblProfitorLoss.Text = decProfit & Not 0) Then
    lblProfitorLoss.BackColor = Color.LightGray
    Else
    lblProfitorLoss.BackColor = Color.Red
    EndIf

    If (lblProfitorLoss.Text = decProfit & Not 0) Then
    lblProfitorLoss.ForeColor = Color.Black
    Else
    lblProfitorLoss.ForeColor = Color.White

    This is the best I can do for the calculation part. There are still some errors in it. Please help me with this.

    decSellingPrice = CDec(txtSellingPrice.Text)
    decCost = CDec(txtCostValue.Text)
    decProfit = CDec(lblProfitorLoss.Text > 0)
    decLoss = CDec(lblProfitorLoss.Text < 0)
    lblProfitorLoss.Text = FormatCurrency(CDec(decSellingPrice - decCost))
    lblCommission.Text = FormatCurrency(CDec(decProfit Or decLoss) * 0.2D)

  • #2
    Is this a school project or something?

    Comment


    • #3
      Originally posted by HtTKar View Post
      Is this a school project or something?
      It is a homework assignmen. This is what they give us after two weeks of class.

      Comment


      • #4
        whew!
        I just read the first post and halfway through my eyes started to cross and throb. Now I have to go lay down!

        Sorry man, not my "forte"...

        Comment

        Working...
        X