Results 1 to 7 of 7

Thread: [RESOLVED] how to Divide value from 2 text box and show result to another text box

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Posts
    90

    Resolved [RESOLVED] how to Divide value from 2 text box and show result to another text box

    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.

    Name:  ds.jpg
Views: 3205
Size:  27.8 KB

    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
    Last edited by BONITO; Jul 11th, 2018 at 04:01 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width