如以下代码,窗体有一个新增按钮,点击后,新增行正常
但指针不会指向新增的行。
Dim N As Integer= cint(cstr(Date.Today.year).SubString(2) & Format(Date.Today.month,"00"))
Dim max As String = mtb.Compute("max(入仓单号)")
Dim Vdh As String = "QC-YC"
Dim max1 As String
If max Is Nothing Then
max1 = Vdh & n & format(1, "000")
Else
Dim S As Integer =max.SubString(5,4)
Dim Dsn As Integer
If S < N Then
dsn=n
Else
dsn=s
End If
'msgbox(max)
If max = "" Then
max1 = Vdh & dsn & format(1, "000")
Else
max1 = Vdh & dsn & format(cint(max.SubString(9)) + 1, "000")
End If
End If
Dim Vdr As DataRow
vdr = mdtb.AddNew()
vdr("入仓单号")=max1
vdr("到货日期")=Date.now
mrcsn=max1
Forms("入仓单编辑").open()