Question

******The posted solution does not work. I have coded everything exactly the way the solution is posted here, but does not work. PLEASE HELP! These are the form element names I used.

Form elements ListBox Textbox1(Sales) Textbox2(Report) Button1(Add to totals) Button2(Create report) Button3(Exit) salesIDLis

Case Projects - JM Sales, pg. 501 JM Sales employs five salespeople. The sales manager wants an application that allows him to enter any number of sales amounts for each of the five salespeople. The application should accumulate the sales amounts in a one-dimensional array. The application should also display a report similar to the one shown in Figure 9-39. The report contains each salesperson’s ID and total sales. It also contains the total company sales. Use the following names for the solution and project, respectively: JM Sales Solution and JM Sales Project. Change the form file’s name to Main Form.vb. You can either create your own interface or create the one shown in Figure 9-39. The text box that displays the report has its BorderStyle property set to Fixed3D, its Font property set to Courier New 10pt, its MultiLine and ReadOnly properties set to True, and its ScrollBars property set to Vertical.

X M Sales Sales ID: Sales: 101 Add to Totals 112 203 301 302 Sales totals: 101 7,500 112 5,690 Create Report 203 1,340 Exit 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

Public Class Form1
Dim ids() As Integer = {101, 112, 203, 301, 302}
Dim sales(5) As Integer
Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click
Me.Close()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For i As Integer = 0 To 4
salesIDListBox.Items.Add(ids(i))
sales(i) = 0
Next

End Sub

Private Sub addButton_Click(sender As Object, e As EventArgs) Handles addButton.Click
Dim index As Integer
Dim sales_value As Integer
index = salesIDListBox.SelectedIndex
sales_value = Convert.ToInt32(salesTextBox.Text)
sales(index) += sales_value
End Sub

Private Sub reportButton_Click(sender As Object, e As EventArgs) Handles reportButton.Click
Dim total_sales As Integer = 0
Dim str As String = ""
Dim format As String = "{0,6} {1,6}"
For i As Integer = 0 To 4
total_sales += sales(i)
str += String.Format(format, ids(i), sales(i).ToString("0,0", Globalization.CultureInfo.InvariantCulture)) + vbCrLf
Next

str += vbCrLf & vbCrLf & String.Format(format, "Total", "$" + total_sales.ToString("0,0", Globalization.CultureInfo.InvariantCulture)) + vbCrLf
reportTextBox.Text = str

End Sub
End Class

outputs

Photos phpWu4ahB.png Add to Share See all photos S2 Edit & Create JM Sales IM Sales X Sales ID: Sales: 101 112 203 301 302 SaPhotos phpWu4ahB.png Share See all photos Add to S2 Edit & Create JM Sales IM Sales X Sales ID: Sales: 101 112 203 301 302 SaPhotos phpWu4ahB.png Share See all photos Add to S2 Edit & Create JM Sales IM Sales X Sales ID: Sales: 101 112 203 301 302 SaPhotos phpWu4ahB.png Add to Share See all photos S2 Edit & Create JM Sales IM Sales X Sales ID: Sales: 101 112 203 301 302 Sa

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
******The posted solution does not work. I have coded everything exactly the way the solution is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use...

    PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use the following names for the project and solution, respectively: Chopkins Project and Chopkins Solution. Save the application in the VB2017\Chap03 folder. Change the form file's name to Main Form.vb. Change the form's name to frmMain. Create the interface shown in Figure 3-37. The interface contains six labels, three text boxes, and two buttons. The application calculates and displays the total number of packs ordered...

  • Here is everything I have on my codes, the compiler does not allow me to input...

    Here is everything I have on my codes, the compiler does not allow me to input my name, it will print out "Please enter your name: " but totally ignores it and does not allow me to input my name and just proceeds to my result of ID and Sale. Please help. I've bolded the part where it I should be able to input my name package salesperson; public class Salesperson { String Names; int ID; double Sales; // craeting...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

  • can someone help with the blue reader project, please? I have the journal entries I need...

    can someone help with the blue reader project, please? I have the journal entries I need help with journal ledger and trial balance so I can I do the financial statements. thanks can someone help me the ledger and trial balance please, I posted all the information about the picture Credit The accounting cycle illustrated below is designed to provide information about a company's profitability for lack thereof) along with many other important financial characteristics. This same accounting Cycle is...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT