I am creating a Solar PV Calculator using ASP Web Forms and VB backend. I just looked at my code and being a novice VB.NET developer, I just wanted to know if there is a way to do something differently, reduce the amount of lines of code or something similar. Here’s a cumbersome part of y code:
Dim SR As Integer
'Store radiation value
If drpDwnRoofFacing.Text = "South" And drpAngleOfRoof.Text = "Horizontal" Then
SR = 933
ElseIf drpDwnRoofFacing.Text = "SE/SW" And drpAngleOfRoof.Text = "Horizontal" Then
SR = 933
ElseIf drpDwnRoofFacing.Text = "E/W" And drpAngleOfRoof.Text = "Horizontal" Then
SR = 933
ElseIf drpDwnRoofFacing.Text = "NE/NW" And drpAngleOfRoof.Text = "Horizontal" Then
SR = 933
ElseIf drpDwnRoofFacing.Text = "North" And drpAngleOfRoof.Text = "Horizontal" Then
SR = 933
ElseIf drpDwnRoofFacing.Text = "South" And drpAngleOfRoof.Text = "30 Degrees" Then
SR = 1042
ElseIf drpDwnRoofFacing.Text = "SE/SW" And drpAngleOfRoof.Text = "30 Degrees" Then
SR = 997
ElseIf drpDwnRoofFacing.Text = "E/W" And drpAngleOfRoof.Text = "30 Degrees" Then
SR = 886
ElseIf drpDwnRoofFacing.Text = "NE/NW" And drpAngleOfRoof.Text = "30 Degrees" Then
SR = 762
ElseIf drpDwnRoofFacing.Text = "North" And drpAngleOfRoof.Text = "30 Degrees" Then
SR = 709
ElseIf drpDwnRoofFacing.Text = "South" And drpAngleOfRoof.Text = "45 Degrees" Then
SR = 1023
ElseIf drpDwnRoofFacing.Text = "SE/SW" And drpAngleOfRoof.Text = "45 Degrees" Then
SR = 968
ElseIf drpDwnRoofFacing.Text = "E/W" And drpAngleOfRoof.Text = "45 Degrees" Then
SR = 829
ElseIf drpDwnRoofFacing.Text = "NE/NW" And drpAngleOfRoof.Text = "45 Degrees" Then
SR = 666
ElseIf drpDwnRoofFacing.Text = "North" And drpAngleOfRoof.Text = "45 Degrees" Then
SR = 621
ElseIf drpDwnRoofFacing.Text = "South" And drpAngleOfRoof.Text = "60 Degrees" Then
SR = 960
ElseIf drpDwnRoofFacing.Text = "SE/SW" And drpAngleOfRoof.Text = "60 Degrees" Then
SR = 900
ElseIf drpDwnRoofFacing.Text = "E/W" And drpAngleOfRoof.Text = "60 Degrees" Then
SR = 753
ElseIf drpDwnRoofFacing.Text = "NE/NW" And drpAngleOfRoof.Text = "60 Degrees" Then
SR = 580
ElseIf drpDwnRoofFacing.Text = "North" And drpAngleOfRoof.Text = "60 Degrees" Then
SR = 485
ElseIf drpDwnRoofFacing.Text = "South" And drpAngleOfRoof.Text = "Vertical" Then
SR = 724
ElseIf drpDwnRoofFacing.Text = "SE/SW" And drpAngleOfRoof.Text = "Vertical" Then
SR = 684
ElseIf drpDwnRoofFacing.Text = "E/W" And drpAngleOfRoof.Text = "Vertical" Then
SR = 565
ElseIf drpDwnRoofFacing.Text = "NE/NW" And drpAngleOfRoof.Text = "Vertical" Then
SR = 427
ElseIf drpDwnRoofFacing.Text = "North" And drpAngleOfRoof.Text = "Vertical" Then
SR = 360
End If
1 Answer