iam making a simple computation but iam having a problem with this
If btnAdd.Text = "&Add" Then
cbleave.Enabled = True
dtFrom.Enabled = True
dtTo.Enabled = True
dtApplied.Enabled = True
clear()
btnAdd.Text = "&Save"
btnSearch.Enabled = True
sql = "SELECT IFNULL(MAX(cnt),0) FROM tblleaveapp"
NewDataSet(sql)
Else
If cbleave.Text = String.Empty Then
MsgBox("Choose Leave Type.", MsgBoxStyle.Information, Me.Text)
Exit Sub
End If
sql = "SELECT leaveLeft FROM tblleaveapp"
NewDataSet(sql)
If ds.Tables("a").Rows.Count > 0 Then
Else
Dim available As Integer
Dim days As Integer
Dim use As Integer
days = Integer.Parse(txtnumber.Text)
use = Integer.Parse(txtUse.Text)
available = days - use
txtavailable.Text = available.ToString
End If
Dim available As Integer
Dim days As Integer
Dim use As Integer
days = Integer.Parse(txtnumber.Text)
use = Integer.Parse(txtUse.Text)
available = days - use
txtavailable.Text = available.ToString
sql = "INSERT INTO tblleaveapp (employeeID, leaveType, leaveNumber, `from`, `to`, leaveUse, applied, leaveLeft) VALUES ('" & replaceQuote(txtID.Text) & "','" & replaceQuote(cbleave.Text) & "','" & replaceQuote(txtnumber.Text) & "','" & replaceQuote(dtFrom.Text) & "','" & replaceQuote(dtTo.Text) & "','" & replaceQuote(txtUse.Text) & "','" & replaceQuote(dtApplied.Text) & "','" & replaceQuote(txtavailable.Text) & "' )"
SaveRecord(sql)
clear()
cbleave.Enabled = False
dtFrom.Enabled = False
dtTo.Enabled = False
dtApplied.Enabled = False
btnAdd.Text = "&Add"
btnSearch.Enabled = False
MsgBox("Are you sure you want to save this data? This data cannot be edited.", MsgBoxStyle.Information + MsgBoxStyle.YesNo, Me.Text)
End If
the logic is i need to subtract the available days to to desire days and then the total of the two will become my available days to another transaction
example:
10 - 2 = 8
8 - 6 = 2
2 - 2 = 0
something like that please help me
thanks in advance