hi All,
I am creating program to divide two numbers from different text box and show the result in another text box .
I don't know why i am getting 100.00 % as answer it should be 54.93% as per computed in excel.
code
Code:If dr.HasRows Then Dim dtRecords As New DataTable dtRecords.Load(dr) DataGridView1.DataSource = dtRecords Dim rows = dtRecords.Rows Dim lastRow = rows(rows.Count - 1) Dim totalOk = CInt(lastRow("TotalOK")) Dim total_Input = CInt(lastRow("Total")) Dim yield = totalOk / total_Input txtTotalOk.Text = totalOk.ToString() txtTotalInput.Text = total_Input.ToString() txtYieldRate.Text = yield.ToString("p2") Dim noFixture As Integer = txtTarget.Text * 6 'multiply with no.of fixture. txtTarget.Text = noFixture 'target(user input) * no of fixture Dim Efficiency As Integer Efficiency = txtTotalInputEff.Text / txtTarget.Text txtTotalInputEff.Text = total_Input.ToString() ' last row txtEfficiency.Text = Efficiency.ToString("p2") ' txtEfficiency.Text = Efficiency.ToString("p2") End If dr.Close() connection.Close() End Sub




Reply With Quote
