Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
Greetings!
I have run out of wits, to make the attached program work
It compiled, but does not do the calculations
Could someone please spare some time to check this out for me?
Only three, 3 inputs are required, as follows:
 	Profit, after tax
 	Revenue, total                                                                         
 	Value Added, calculated as (revenue – cost of materials)
Data is required for 5yrs, at the least
Program is designed for up to 20yrs of data
It has been designed on expression web4
The bill of health index, BHI puts a value on organizations, according to the capacities for productivity and leadership. 
It is optimum at BHI = 1.42 or √2
It is evaluated as the relativity average of the following two, 2 factors:
 	Business Continuity Index, BCI which would be best at a unity, for BCI = 1
 	Value Creation Index, VCI which is best at duality, for VCI = 2
The relativity average is computed as √ (BCI x VCI) 
Both factors are evaluated as running correlation coefficients, rr over a period of at least five, 5 years
Thus the program runs in three, 3 stages:
1.	Given the three, 3 inputs including profit, revenue and value added; the following four, 4 factors are calculated:
•	Cost of materials, CM
•	Monetized return on investments, MROI 
•	Percentage profit, PPrT
•	Predicted Profit, PPrH 
2.	Then the correlation coefficients for CM and MROI, as well as PPrt and PPrH are calculated as r1 and r2 respectively
3.	Lastly, the two, 2 factors BCI and VCI are evaluated as 2 – r1 and 2 – r2, to find BHI
For healthy organizations, while r1 tends towards a unity for r1 = 1, r2 would tend to zero, for r2 = 0.
Ngbachi 


What I have tried:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="VB" Debug="true"%>

<script runat="server">

Public Sub CommandBHI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CommandBHI.Click

Dim dbln As Integer
Dim i As Integer = dbln
Dim dblPrt(dbln) As Double
Dim dblSls(dbln) As Double
Dim dblVA(dbln) As Double


If IsNumeric(NItems.Text) Then
dbln = CDbl(NItems.Text)
End If


For i = 1 To dbln

If i = 1 And IsNumeric(Profit1.Text) Then
dblPrt(i) = CDbl(Profit1.Text)

ElseIf i = 2 And IsNumeric(Profit2.Text) Then
dblPrt(i) = CDbl(Profit2.Text)

ElseIf i = 3 And IsNumeric(Profit3.Text) Then
dblPrt(i) = CDbl(Profit3.Text)

ElseIf i = 4 And IsNumeric(Profit4.Text) Then
dblPrt(i) = CDbl(Profit4.Text)

ElseIf i = 5 And IsNumeric(Profit5.Text) Then
dblPrt(i) = CDbl(Profit5.Text)

ElseIf i = 6 And IsNumeric(Profit6.Text) Then
dblPrt(i) = CDbl(Profit6.Text)

ElseIf i = 7 And IsNumeric(Profit7.Text) Then
dblPrt(i) = CDbl(Profit7.Text)

ElseIf i = 8 And IsNumeric(Profit8.Text) Then
dblPrt(i) = CDbl(Profit8.Text)

ElseIf i = 9 And IsNumeric(Profit9.Text) Then
dblPrt(i) = CDbl(Profit9.Text)

ElseIf i = 10 And IsNumeric(Profit10.Text) Then
dblPrt(i) = CDbl(Profit10.Text)

ElseIf i = 11 And IsNumeric(Profit11.Text) Then
dblPrt(i) = CDbl(Profit11.Text)

ElseIf i = 12 And IsNumeric(Profit12.Text) Then
dblPrt(i) = CDbl(Profit12.Text)

ElseIf i = 13 And IsNumeric(Profit13.Text) Then
dblPrt(i) = CDbl(Profit13.Text)

ElseIf i = 14 And IsNumeric(Profit14.Text) Then
dblPrt(i) = CDbl(Profit14.Text)

ElseIf i = 15 And IsNumeric(Profit15.Text) Then
dblPrt(i) = CDbl(Profit15.Text)

ElseIf i = 16 And IsNumeric(Profit16.Text) Then
dblPrt(i) = CDbl(Profit16.Text)

ElseIf i = 17 And IsNumeric(Profit17.Text) Then
dblPrt(i) = CDbl(Profit17.Text)

ElseIf i = 18 And IsNumeric(Profit18.Text) Then
dblPrt(i) = CDbl(Profit18.Text)

ElseIf i = 19 And IsNumeric(Profit19.Text) Then
dblPrt(i) = CDbl(Profit19.Text)



End If


If i = 1 And IsNumeric(Sales1.Text) Then
dblSls(i) = CDbl(Sales1.Text)

ElseIf i = 2 And IsNumeric(Sales2.Text) Then
dblSls(i) = CDbl(Sales2.Text)

ElseIf i = 3 And IsNumeric(Sales3.Text) Then
dblSls(i) = CDbl(Sales3.Text)

ElseIf 3 = 4 And IsNumeric(Sales4.Text) Then
dblSls(i) = CDbl(Sales4.Text)

ElseIf i = 5 And IsNumeric(Sales5.Text) Then
dblSls(i) = CDbl(Sales5.Text)

ElseIf i = 6 And IsNumeric(Sales6.Text) Then
dblSls(i) = CDbl(Sales6.Text)

ElseIf i = 7 And IsNumeric(Sales7.Text) Then
dblSls(i) = CDbl(Sales7.Text)

ElseIf i = 8 And IsNumeric(Sales8.Text) Then
dblSls(i) = CDbl(Sales8.Text)

ElseIf i = 9 And IsNumeric(Sales9.Text) Then
dblSls(i) = CDbl(Sales9.Text)

ElseIf i = 10 And IsNumeric(Sales10.Text) Then
dblSls(i) = CDbl(Sales10.Text)

ElseIf i = 11 And IsNumeric(Sales11.Text) Then
dblSls(i) = CDbl(Sales11.Text)

ElseIf i = 12 And IsNumeric(Sales12.Text) Then
dblSls(i) = CDbl(Sales12.Text)

ElseIf i = 13 And IsNumeric(Sales13.Text) Then
dblSls(i) = CDbl(Sales13.Text)

ElseIf i = 14 And IsNumeric(Sales14.Text) Then
dblSls(i) = CDbl(Sales14.Text)

ElseIf i = 15 And IsNumeric(Sales15.Text) Then
dblSls(i) = CDbl(Sales15.Text)

ElseIf i = 16 And IsNumeric(Sales16.Text) Then
dblSls(i) = CDbl(Sales16.Text)

ElseIf i = 17 And IsNumeric(Sales17.Text) Then
dblSls(i) = CDbl(Sales17.Text)

ElseIf i = 18 And IsNumeric(Sales18.Text) Then
dblSls(i) = CDbl(Sales18.Text)

ElseIf i = 19 And IsNumeric(Sales19.Text) Then
dblSls(i) = CDbl(Sales19.Text)



End If



If i = 1 And IsNumeric(ValueAdded1.Text) Then
dblVA(i) = CDbl(ValueAdded1.Text)

ElseIf i = 2 And IsNumeric(ValueAdded2.Text) Then
dblVA(i) = CDbl(ValueAdded2.Text)

ElseIf i = 3 And IsNumeric(ValueAdded3.Text) Then
dblVA(i) = CDbl(ValueAdded3.Text)

ElseIf 3 = 4 And IsNumeric(ValueAdded4.Text) Then
dblVA(i) = CDbl(ValueAdded4.Text)

ElseIf i = 5 And IsNumeric(ValueAdded5.Text) Then
dblVA(i) = CDbl(ValueAdded5.Text)

ElseIf i = 6 And IsNumeric(ValueAdded6.Text) Then
dblVA(i) = CDbl(ValueAdded6.Text)

ElseIf i = 7 And IsNumeric(ValueAdded7.Text) Then
dblVA(i) = CDbl(ValueAdded7.Text)

ElseIf i = 8 And IsNumeric(ValueAdded8.Text) Then
dblVA(i) = CDbl(ValueAdded8.Text)

ElseIf i = 9 And IsNumeric(ValueAdded9.Text) Then
dblVA(i) = CDbl(ValueAdded9.Text)

ElseIf i = 10 And IsNumeric(ValueAdded10.Text) Then
dblVA(i) = CDbl(ValueAdded10.Text)

ElseIf i = 11 And IsNumeric(ValueAdded11.Text) Then
dblVA(i) = CDbl(ValueAdded11.Text)

ElseIf i = 12 And IsNumeric(ValueAdded12.Text) Then
dblVA(i) = CDbl(ValueAdded12.Text)

ElseIf i = 13 And IsNumeric(ValueAdded13.Text) Then
dblVA(i) = CDbl(ValueAdded13.Text)

ElseIf i = 14 And IsNumeric(ValueAdded14.Text) Then
dblVA(i) = CDbl(ValueAdded14.Text)

ElseIf i = 15 And IsNumeric(ValueAdded15.Text) Then
dblVA(i) = CDbl(ValueAdded15.Text)

ElseIf i = 16 And IsNumeric(ValueAdded16.Text) Then
dblVA(i) = CDbl(ValueAdded16.Text)

ElseIf i = 17 And IsNumeric(ValueAdded17.Text) Then
dblVA(i) = CDbl(ValueAdded17.Text)

ElseIf i = 18 And IsNumeric(ValueAdded18.Text) Then
dblVA(i) = CDbl(ValueAdded18.Text)

ElseIf i = 19 And IsNumeric(ValueAdded19.Text) Then
dblVA(i) = CDbl(ValueAdded19.Text)

End If

Next i

Dim Costs As Double
Dim ROI As Double
Dim PVA As Double
Dim PROI As Double
Dim PPtScore(dbln) As Double
Dim PtHScore(dbln) As Double
Dim CM(dbln) As Double
Dim MROI(dbln) As Double
Dim X As Double = 0
Dim Y As Double = 0
Dim A As Double = 0
Dim B As Double = 0

For i = 1 To dbln

Costs = dblSls(i) - dblPrt(i)
ROI = dblSls(i) / Costs
MROI(i) = dblPrt(i) / ROI
CM(i) = dblSls(i) - dblVA(i)

PVA = dblVA(i) / dblSls(i)
PROI = MROI(i) / dblSls(i)
PPtScore(i) = dblPrt(i) / dblSls(i)
PtHScore(i) = math.Sqrt(PVA * PROI)


X = dblPrt(1)
Y = dblSls(1)
A = dblVA(1)
B = Costs


LblCM.Text = "CM = " & Format(CM(i), "0.00")
LblMROI.Text = "MROI = " & Format(MROI(i), "0.00")
LblPPt.Text = "PPt = " & Format(PPtScore(i), "0.00")
LblPtH.Text = "PtH = " & Format(PtHScore(i), "0.00")


If i = 1 Then CM(1) = CM(i)
If i = 2 Then CM(2) = CM(i)
If i = 3 Then CM(3) = CM(i)
If i = 4 Then CM(4) = CM(i)
If i = 5 Then CM(5) = CM(i)
If i = 6 Then CM(6) = CM(i)
If i = 7 Then CM(7) = CM(i)
If i = 8 Then CM(8) = CM(i)
If i = 9 Then CM(9) = CM(i)
If i = 10 Then CM(10) = CM(i)
If i = 11 Then CM(11) = CM(i)
If i = 12 Then CM(12) = CM(i)
If i = 13 Then CM(13) = CM(i)
If i = 14 Then CM(14) = CM(i)
If i = 15 Then CM(15) = CM(i)
If i = 16 Then CM(16) = CM(i)
If i = 17 Then CM(17) = CM(i)
If i = 18 Then CM(18) = CM(i)
If i = 19 Then CM(19) = CM(i)
If i = 20 Then CM(20) = CM(i)


If i = 1 Then MROI(1) = MROI(i)
If i = 2 Then MROI(2) = MROI(i)
If i = 3 Then MROI(3) = MROI(i)
If i = 4 Then MROI(4) = MROI(i)
If i = 5 Then MROI(5) = MROI(i)
If i = 6 Then MROI(6) = MROI(i)
If i = 7 Then MROI(7) = MROI(i)
If i = 8 Then MROI(8) = MROI(i)
If i = 9 Then MROI(9) = MROI(i)
If i = 10 Then MROI(10) = MROI(i)
If i = 11 Then MROI(11) = MROI(i)
If i = 12 Then MROI(12) = MROI(i)
If i = 13 Then MROI(13) = MROI(i)
If i = 14 Then MROI(14) = MROI(i)
If i = 15 Then MROI(15) = MROI(i)
If i = 16 Then MROI(16) = MROI(i)
If i = 17 Then MROI(17) = MROI(i)
If i = 18 Then MROI(18) = MROI(i)
If i = 19 Then MROI(19) = MROI(i)
If i = 20 Then MROI(20) = MROI(i)

If i = 1 Then PPtScore(1) = PPtScore(i)
If i = 2 Then PPtScore(2) = PPtScore(i)
If i = 3 Then PPtScore(3) = PPtScore(i)
If i = 4 Then PPtScore(4) = PPtScore(i)
If i = 5 Then PPtScore(5) = PPtScore(i)
If i = 6 Then PPtScore(6) = PPtScore(i)
If i = 7 Then PPtScore(7) = PPtScore(i)
If i = 8 Then PPtScore(8) = PPtScore(i)
If i = 9 Then PPtScore(9) = PPtScore(i)
If i = 10 Then PPtScore(10) = PPtScore(i)
If i = 11 Then PPtScore(11) = PPtScore(i)
If i = 12 Then PPtScore(12) = PPtScore(i)
If i = 13 Then PPtScore(13) = PPtScore(i)
If i = 14 Then PPtScore(14) = PPtScore(i)
If i = 15 Then PPtScore(15) = PPtScore(i)
If i = 16 Then PPtScore(16) = PPtScore(i)
If i = 17 Then PPtScore(17) = PPtScore(i)
If i = 18 Then PPtScore(18) = PPtScore(i)
If i = 19 Then PPtScore(19) = PPtScore(i)
If i = 20 Then PPtScore(20) = PPtScore(i)

If i = 1 Then PtHScore(1) = PtHScore(i)
If i = 2 Then PtHScore(2) = PtHScore(i)
If i = 3 Then PtHScore(3) = PtHScore(i)
If i = 4 Then PtHScore(4) = PtHScore(i)
If i = 5 Then PtHScore(5) = PtHScore(i)
If i = 6 Then PtHScore(6) = PtHScore(i)
If i = 7 Then PtHScore(7) = PtHScore(i)
If i = 8 Then PtHScore(8) = PtHScore(i)
If i = 9 Then PtHScore(9) = PtHScore(i)
If i = 10 Then PtHScore(10) = PtHScore(i)
If i = 11 Then PtHScore(11) = PtHScore(i)
If i = 12 Then PtHScore(12) = PtHScore(i)
If i = 13 Then PtHScore(13) = PtHScore(i)
If i = 14 Then PtHScore(14) = PtHScore(i)
If i = 15 Then PtHScore(15) = PtHScore(i)
If i = 16 Then PtHScore(16) = PtHScore(i)
If i = 17 Then PtHScore(17) = PtHScore(i)
If i = 18 Then PtHScore(18) = PtHScore(i)
If i = 19 Then PtHScore(19) = PtHScore(i)
If i = 20 Then PtHScore(20) = PtHScore(i)

Next i

Dim BHIScore As Double
Dim CrScore As Double
Dim CpScore As Double
Dim Exy, Ex, Ey, Ex2, Ey2 As Double
Dim Eab, Ea, Eb, Ea2, Eb2 As Double
Dim BCI As Double = 0
Dim VCI As Double = 0
Dim VCI1 As Double = 0
Dim VCI2 As Double = 0


For i = 1 To dbln

If i = 1 Then X = CM(1)
If i = 2 Then X = CM(2)
If i = 3 Then X = CM(3)
If i = 4 Then X = CM(4)
If i = 5 Then X = CM(5)
If i = 6 Then X = CM(6)
If i = 7 Then X = CM(7)
If i = 8 Then X = CM(8)
If i = 9 Then X = CM(9)
If i = 10 Then X = CM(10)
If i = 11 Then X = CM(11)
If i = 12 Then X = CM(12)
If i = 13 Then X = CM(13)
If i = 14 Then X = CM(14)
If i = 15 Then X = CM(15)
If i = 16 Then X = CM(16)
If i = 17 Then X = CM(17)
If i = 18 Then X = CM(18)
If i = 19 Then X = CM(19)
If i = 20 Then X = CM(20)


If i = 1 Then Y = MROI(1)
If i = 2 Then Y = MROI(2)
If i = 3 Then Y = MROI(3)
If i = 4 Then Y = MROI(4)
If i = 5 Then Y = MROI(5)
If i = 6 Then Y = MROI(6)
If i = 7 Then Y = MROI(7)
If i = 8 Then Y = MROI(8)
If i = 9 Then Y = MROI(9)
If i = 10 Then Y = MROI(10)
If i = 11 Then Y = MROI(11)
If i = 12 Then Y = MROI(12)
If i = 13 Then Y = MROI(13)
If i = 14 Then Y = MROI(14)
If i = 15 Then Y = MROI(15)
If i = 16 Then Y = MROI(16)
If i = 17 Then Y = MROI(17)
If i = 18 Then Y = MROI(18)
If i = 19 Then Y = MROI(19)
If i = 20 Then Y = MROI(20)


If i = 1 Then A = PPtScore(1)
If i = 2 Then A = PPtScore(2)
If i = 3 Then A = PPtScore(3)
If i = 4 Then A = PPtScore(4)
If i = 5 Then A = PPtScore(5)
If i = 6 Then A = PPtScore(6)
If i = 7 Then A = PPtScore(7)
If i = 8 Then A = PPtScore(8)
If i = 9 Then A = PPtScore(9)
If i = 10 Then A = PPtScore(10)
If i = 11 Then A = PPtScore(11)
If i = 12 Then A = PPtScore(12)
If i = 13 Then A = PPtScore(13)
If i = 14 Then A = PPtScore(14)
If i = 15 Then A = PPtScore(15)
If i = 16 Then A = PPtScore(16)
If i = 17 Then A = PPtScore(17)
If i = 18 Then A = PPtScore(18)
If i = 19 Then A = PPtScore(19)
If i = 20 Then A = PPtScore(20)


If i = 1 Then B = PtHScore(1)
If i = 2 Then B = PtHScore(2)
If i = 3 Then B = PtHScore(3)
If i = 4 Then B = PtHScore(4)
If i = 5 Then B = PtHScore(5)
If i = 6 Then B = PtHScore(6)
If i = 7 Then B = PtHScore(7)
If i = 8 Then B = PtHScore(8)
If i = 9 Then B = PtHScore(9)
If i = 10 Then B = PtHScore(10)
If i = 11 Then B = PtHScore(11)
If i = 12 Then B = PtHScore(12)
If i = 13 Then B = PtHScore(13)
If i = 14 Then B = PtHScore(14)
If i = 15 Then B = PtHScore(15)
If i = 16 Then B = PtHScore(16)
If i = 17 Then B = PtHScore(17)
If i = 18 Then B = PtHScore(18)
If i = 19 Then B = PtHScore(19)
If i = 20 Then B = PtHScore(20)


Exy += (X * Y)
Ex += X
Ey += Y
Ex2 += X ^ 2
Ey2 += Y ^ 2

If CrScore = (dbln * (Exy) - (Ex * Ey)) / (((dbln * (Ex2) - (Ex) ^ 2) ^ (1 / 2)) * ((dbln * (Ey2) - (Ey) ^ 2) ^ (1 / 2))) = 0 Then
CrScore = 1
Else
CrScore = (dbln * (Exy) - (Ex * Ey)) / (((dbln * (Ex2) - (Ex) ^ 2) ^ (1 / 2)) * ((dbln * (Ey2) - (Ey) ^ 2) ^ (1 / 2)))
End If

Eab += (A * B)
Ea += A
Eb += B
Ea2 += A ^ 2
Eb2 += B ^ 2

If CpScore = (dbln * (Eab) - (Ea * Eb)) / (((dbln * (Ea2) - (Ea) ^ 2) ^ (1 / 2)) * ((dbln * (Eb2) - (Eb) ^ 2) ^ (1 / 2))) = 0 Then
CpScore = 1
Else
CpScore = (dbln * (Eab) - (Ea * Eb)) / (((dbln * (Ea2) - (Ea) ^ 2) ^ (1 / 2)) * ((dbln * (Eb2) - (Eb) ^ 2) ^ (1 / 2)))
End If


BCI = 2 - CrScore
VCI1 = 2 - CpScore

If VCI1 = 1 Then
VCI2 = 1
Else
VCI2 = 1 - 1 / VCI1

End If

VCI = 1 / VCI2


BHIScore = math.Sqrt(BCI * VCI)

LblCr.Text = "Cr = " & Format(X, "0.00")
LblCp.Text = "Cp = " & Format(Y, "0.00")
LblBCI.Text = "BCI = " & Format(A, "0.00")
LblVCI.Text = "VCI = " & Format(B, "0.00")
LblBHI.Text = "BHI = " & Format(BHIScore, "0.00")


Next i

End Sub

Public Sub Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit.Click

Dim myConnection As Data.OleDb.OleDbConnection
Dim myCommand As Data.OleDb.OleDbCommand
Dim mySQLString As String

myConnection = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Transfered Files\Database Items\Identity\SnIdentity11.mdb;")
myConnection.Open()

mySQLString = "INSERT INTO SnIdentity11.mdb VALUES('SnScore(0)','SnScore(1)')"
myCommand = New Data.OleDb.OleDbCommand(mySQLString, myConnection)
myCommand.ExecuteNonQuery()

End Sub

</script>

<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>BHI</title>
<meta name="keywords" content="Spirituality, Materiality, “Natural Order”, “Personal Order”, Consciousness, Intuition,
Rationality, Spirit, Soul, Mind, Matter, F-Scale" />
<meta name="description" content="The Identity Kit is a measure of the appropriateness of a person's system of values,
according to the alignment of the ability set and skill set, in order to predict the performance at task." />
<meta content="General" name="rating" />
<meta content="Copyright © 2014, Agape Consultants All Rights Reserved" name="copyright" />

<link href="../Identity%20Kit/Identity%20Kit.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.auto-style3 {
color: #800000;
}
</style>
</head>
<body class="Text3">

<form id="form1" runat="server" style="height: 700px">
<label id="Label1" class="header"> 

        
<input height="86" longdesc="../Pdfs/Management by Objectives, Viewed from the Perspective of adopting the F-Scale for optimum Leadership.pdf" name="Working_Hands" src="../Images/Working%20Hands.jpg" type="image" width="66" />                                                   
BHI                                       
 
<input height="55" longdesc="../Pdfs/Agape Consultants Gboko, Profile.pdf" name="Avatar" src="../Images/Avatar.jpg" type="image" width="138" />  </label>


              

      <label for="Profit" class="auto-style3">           Profit                         </label>
<label for="Sales" class="auto-style3">Sales</label><label for="ValueAdded" class="auto-style3">                   ValueAdded</label><label for="Profit" class="auto-style3">                     Profit                        </label>
<label for="Sales" class="auto-style3">Sales</label><label for="ValueAdded" class="auto-style3">                   ValueAdded</label>           <asp:TextBox ID="NItems" runat="server">

     
<asp:TextBox id="Profit0" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales0" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded0" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit10" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales10" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded10" runat="server" class="Text2" Width="135px">
    <asp:TextBox ID="LblCM" runat="server">


  
  
<asp:TextBox id="Profit1" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales1" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded1" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit11" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales11" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded11" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblMROI" runat="server">


  
  
<asp:TextBox id="Profit2" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales2" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded2" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit12" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales12" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded12" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblPPt" runat="server">


  
  
<asp:TextBox id="Profit3" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales3" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded3" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit13" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales13" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded13" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblPtH" runat="server">


      <asp:TextBox id="Profit4" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales4" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded4" runat="server" class="Text2" Width="135px">
     
<asp:TextBox id="Profit14" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales14" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded14" runat="server" class="Text2" Width="135px">


      <asp:TextBox id="Profit5" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales5" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded5" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit15" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales15" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded15" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblCr" runat="server">


  
   <asp:TextBox id="Profit6" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales6" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded6" runat="server" class="Text2" Width="135px">
     
<asp:TextBox id="Profit16" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales16" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded16" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblCp" runat="server">


  
   <asp:TextBox id="Profit7" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales7" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded7" runat="server" class="Text2" Width="135px">
     
<asp:TextBox id="Profit17" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales17" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded17" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblBCI" runat="server">


  
   <asp:TextBox id="Profit8" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales8" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded8" runat="server" class="Text2" Width="135px">
     
<asp:TextBox id="Profit18" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales18" runat="server" class="Text2" Width="135px">
 
<asp:TextBox id="ValueAdded18" runat="server" class="Text2" Width="135px">
   
<asp:TextBox ID="LblVCI" runat="server">


  
   <asp:TextBox id="Profit9" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales9" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded9" runat="server" class="Text2" Width="135px">
      <asp:TextBox id="Profit19" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="Sales19" runat="server" class="Text2" Width="135px">
  <asp:TextBox id="ValueAdded19" runat="server" class="Text2" Width="135px">
    <asp:TextBox ID="LblBHI" runat="server">    


                                                     
                  
                      <asp:Button ID="CommandBHI" runat="server" style="width: 112px" Text="Calculate">
       <asp:Button id="Submit" runat="server" Text="Submit" Width="135px" />


  
    <input height="175" longdesc="../Pdfs/Making Global Leaders, An HR Imperative.pdf" name="Thinking_Man" src="../Images/Thinking%20Man.jpg" type="image" width="129" />
                                                            

                                                                                     
  


  
          
  
    


  
          
  
                                                                                   


  
                                                    
  
 

                                                     
                                                    


  
                                                               


  
                                         


  
                     


  
                                                              
  

                                                                                                               
  

                                                                                                               
 
</form>

</body>

</html>
Posted
Updated 21-Feb-16 22:05pm

1 solution

No - because we have no idea what it should be producing, and no access to your data to test it! :laugh:
This is a part of development: getting the code you wrote to work. It's a skill, and it's called debugging. Like all skills, it only develops and improves with use.

So start with the Debugger. Some of these may help: debugging vb.net - Google Search[^]
 
Share this answer
 
Comments
Member 10957191 22-Feb-16 8:58am    
Thanks! I'll go through the tutorials suggested. I appreciate a million. Anyebe
OriginalGriff 22-Feb-16 9:15am    
You're welcome.
If you meet a specific problem, feel free to ask a question about it and we'll try to be more specific! :laugh:
Member 10957191 3-Mar-16 2:54am    
Greetings once more!

I am still unable to get the maths to work
All the error messages were on the design and not the code

There is definitely something I am not doing right
Could someone please debug this for me

Sample data:

Sales VA Profit Costs ROI MROI CM EntF %VA %ROI %Pr Pr' CM'

48017 28964 11809 36208.00 1.33 8904.77 19053 0.51 0.60 0.19 0.25 0.33 0.47
46542 28327 11458 35084.00 1.33 8637.20 18215 0.50 0.61 0.19 0.25 0.34 0.47
35119 22426 14207 20912.00 1.68 8459.72 12693 0.89 0.64 0.24 0.40 0.39 0.67
30990 11088 8946 22044.00 1.41 6363.52 19902 1.04 0.36 0.21 0.29 0.27 0.32
31944 20570 7439 24505.00 1.30 5706.63 11374 0.45 0.64 0.18 0.23 0.34 0.50
28857 18451 7873 20984.00 1.38 5725.02 10406 0.54 0.64 0.20 0.27 0.36 0.55
24088 15925 6578 17510.00 1.38 4781.67 8163 0.53 0.66 0.20 0.27 0.36 0.59
23104 14909 6690 16414.00 1.41 4752.84 8195 0.58 0.65 0.21 0.29 0.36 0.58
21742 14068 6222 15520.00 1.40 4441.42 7674 0.57 0.65 0.20 0.29 0.36 0.58
20857 13081 5495 15362.00 1.36 4047.28 7776 0.53 0.63 0.19 0.26 0.35 0.52

VC r = 0.8038
PR r = 0.4102
BCI = 1.5898
VCI = 6.0968
BHI = 3.1133

After my debug attempt this is what I got:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="VB" Debug="true"%>

<script runat="server">

Public Sub CommandBHI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CommandBHI.Click

Dim dbln As Integer
Dim i As Integer = dbln
Dim dblPrt(dbln) As Double
Dim dblSls(dbln) As Double
Dim dblVA(dbln) As Double


If IsNumeric(NItems.Text) Then
dbln = CDbl(NItems.Text)
End If


For i = 1 To dbln

If i = 1 And IsNumeric(Profit1.Text) Then
dblPrt(i) = CDbl(Profit1.Text)

ElseIf i = 2 And IsNumeric(Profit2.Text) Then
dblPrt(i) = CDbl(Profit2.Text)

ElseIf i = 3 And IsNumeric(Profit3.Text) Then
dblPrt(i) = CDbl(Profit3.Text)

ElseIf i = 4 And IsNumeric(Profit4.Text) Then
dblPrt(i) = CDbl(Profit4.Text)

ElseIf i = 5 And IsNumeric(Profit5.Text) Then
dblPrt(i) = CDbl(Profit5.Text)

ElseIf i = 6 And IsNumeric(Profit6.Text) Then
dblPrt(i) = CDbl(Profit6.Text)

ElseIf i = 7 And IsNumeric(Profit7.Text) Then
dblPrt(i) = CDbl(Profit7.Text)

ElseIf i = 8 And IsNumeric(Profit8.Text) Then
dblPrt(i) = CDbl(Profit8.Text)

ElseIf i = 9 And IsNumeric(Profit9.Text) Then
dblPrt(i) = CDbl(Profit9.Text)

ElseIf i = 10 And IsNumeric(Profit10.Text) Then
dblPrt(i) = CDbl(Profit10.Text)

ElseIf i = 11 And IsNumeric(Profit11.Text) Then
dblPrt(i) = CDbl(Profit11.Text)

ElseIf i = 12 And IsNumeric(Profit12.Text) Then
dblPrt(i) = CDbl(Profit12.Text)

ElseIf i = 13 And IsNumeric(Profit13.Text) Then
dblPrt(i) = CDbl(Profit13.Text)

ElseIf i = 14 And IsNumeric(Profit14.Text) Then
dblPrt(i) = CDbl(Profit14.Text)

ElseIf i = 15 And IsNumeric(Profit15.Text) Then
dblPrt(i) = CDbl(Profit15.Text)

OriginalGriff 3-Mar-16 3:07am    
What the heck is that? :laugh:
Sorry, but why do you have a loop at all if all you are doing is making your life more complicated by needed to check which iteration you are in?
I have no idea what values you expect to get, or why would expect to get them, and I can't debug that code if I wanted to as it's one method which relies on external data that I don't have.
Stop, step back, think about what you are trying to achieve, and then use the debugger yourself to work out what is happening - because at the moment I can't help thinking that you are coding by the "guess and hope" method -and trust me, that isn't going to work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900