Private Sub Label6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.TextChanged
On Error Resume Next
For i = OA To OB
txtobamt.Text = OA
txtcashrecvd.Text = PA
txtcb.Text = OB
conn = New SqlConnection(cnString)
Dim Sql As String = "Select distinct(slno),OB,OA,PA from Balance_view where slno='" + Label6.Text + "' and stu='A' order by OA "
conn.Open()
Dim cmd As New SqlCommand(Sql, conn)
Dim rs As SqlDataReader
rs = cmd.ExecuteReader
While rs.Read
txtobamt.Text = (rs(2).ToString())
OA = Val(OB) - Val(PA)
End While
rs.Close()
Next
End Sub
Private Sub txtobamt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtobamt.TextChanged
txtcb.Text = Val(txtobamt.Text) -Val(txtcashrecvd.Text)
End Sub
Private Sub txtcashrecvd_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcashrecvd.TextChanged
txtcb.Text = Val(txtobamt.Text) -Val(txtcashrecvd.Text)
End Sub
Private Sub txtcb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcb.TextChanged
txtcb.Text = Val(txtobamt.Text) -Val(txtcashrecvd.Text)
End Sub
Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
On Error Resume Next
txtobamt.Text = OA
txtcashrecvd.Text = PA
txtcb.Text = OB
Dim i As Integer
Dim CurrentDayCash As Decimal
Dim ClosingBal As Decimal
Dim NextDayOpeningBal As Decimal
For i = 0 To j
If i = j Then i -= 1
With Me.DataGridView2
OA = .Rows(i).Cells(4).Value
PA = .Rows(i).Cells(3).Value
OB = Val(PA) - Val(OA)
.Rows(i + 1).Cells(4).Value = OB
End With
If i + 1 = j Then Exit For
Next
End Sub
can any one help me plz?

Vithal WadjePosted Apr 2, 2015, 2:01 PM