Electricity Bill Program

Burke, Brendan J 141 Reputation points
2022-04-07T21:57:08.323+00:00

191142-electricity-bill-instructions.jpg191074-electricity-bill-designer-window.jpg191104-electricity-bill-code-editor-window.jpg

I need help with the parts in bold.

Developer technologies | VB
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2022-04-08T06:46:08.38+00:00

    Hi @Burke, Brendan J ,
    Please learn about Array Class and Standard numeric format strings

        Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click  
            Dim bills(12) As String  
            bills = Split("12.50,22.00,16.46,34.55,121.11,19.00,43.25,66.70,98.44,80.00,56.67,5.57", ",")  
            Dim sum As Decimal  
            For Each bill As String In bills  
                sum += bill  
            Next  
            Dim monthlybill = sum / 12  
            lblBill.Text = monthlybill.ToString("C", CultureInfo.CurrentCulture)  
        End Sub  
    

    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.