Question: Public Class Form1 Private Sub CompleteReport_Click(sender As Object, e As EventArgs) Handles CompleteReport.Click Dim room As Double 'Assigns room as double Dim rate As Double
Public Class Form1
Private Sub CompleteReport_Click(sender As Object, e As EventArgs) Handles CompleteReport.Click Dim room As Double 'Assigns room as double Dim rate As Double 'Assigns rate as double Dim room2 As Double 'Assigns room as double Dim overallRate As Double 'Assigns overall as double Dim a As Integer 'Assign a as an integer For a = 1 To 8 'Assign a as an 1 to 8 for all 8 floors
With Me Try
'Creates an error message if a number is not entered Catch InputBox As Exception MessageBox.Show("Must be a number")
End Try End With
room = InputBox("Enter the number of rooms occupied on this floor." + a.ToString, "Data Needed") rate = (room / 30) * 100 room2 = room + room2 overallRate = (room2 / 240) * 100 DataTxtBx.Items.Add("Floor: " + a.ToString() + "Rooms Occupied: " + room.ToString() + "" + " Occupancy Rate: " + Format(rate, "0.00") + "%")
TotalRoomTxtBx.Text = room2.ToString OverallRateTxtBx.Text = Format(overallRate, "0.00") + "%"
Next End Sub
Private Sub Clear_Click(sender As Object, e As EventArgs) Handles Clear.Click DataTxtBx.Clear() TotalRoomTxtBx.Clear() OverallRateTxtBx.Clear()
End Sub
Private Sub ExitBut_Click(sender As Object, e As EventArgs) Handles ExitBut.Click Me.Close() End Sub End Class
Error is showing up on following line
DataTxtBx.Items.Add("Floor: " + a.ToString() + "Rooms Occupied: " + room.ToString() + "" + " Occupancy Rate: " + Format(rate, "0.00") + "%")
I need all data to show up inside the DataTxBx but I am getting the error that items.add is not part of text box
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
