Question: Could someone translate this vb code to structured english/gcode where appropriate? (i.e Declare mailbox named etc..) 1.Public Class Form1 2. Private Sub btnDisplay_Click(ByVal sender As

Could someone translate this vb code to structured english/gcode where appropriate? (i.e Declare mailbox named etc..)

1.Public Class Form1 2. Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click 3. 'gets all lines from the USStates text file into states array 4. Dim states() As String = IO.File.ReadAllLines("USStates.txt") 5. 'query to get all states areas of the US 6. Dim query = From state In states 7. Let data = state.Split(","c) 8. Let area = CDbl(data(2)) 9. Select area 10. 'Calculating total area of US 11. Dim areasArray() As Double = query.ToArray 12. Dim totalArea As Double = areasArray.Sum 13. 'query to get the state's name and percentage of area 14. Dim qury = From state In states 15. Let data = state.Split(","c) 16. Let name = data(0) 17. Let area = CDbl(data(2)) 18. Let percentage = area / totalArea 19. Let percent = FormatPercent(percentage) 20. Order By percentage Descending 21. Select name, percent 22. 'sets query data to the datasource property of grid view 23. dgvStates.DataSource = qury.Tolist 24. 'to disable default selection of grid view 25. dgvStates.CurrentCell = Nothing 26. 'sets colum names of data grid view 27. dgvStates.Columns("name").HeaderText = "State" 28. dgvStates.Columns("percent").HeaderText = "Percentage of Total Area" 29. End Sub 30.End Class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!