Imports DD_LIB_Standards Public Class frmWM_CreateVersion Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click Me.Close() End Sub Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click clsDatabase.GUI = True For Each row As DataRow In CURRENT_DT_SELECTED_FILES.Rows If clsWD_SET.Create_Version(row.Item("FILEPATH"), txtComment.Text) Then MsgBox("Version was created successfully!", MsgBoxStyle.Information) Dim sql = "SELECT Version from TBPMO_DOCRESULT_LIST Where DocID = " & row.Item("DOC_ID") Dim VERSION = clsDatabase.Execute_Scalar(sql, True) If Not IsNothing(VERSION) Then VERSION = VERSION + 1 Dim upd = String.Format("UPDATE TBPMO_DOCRESULT_LIST SET Version = {0},Change_DateTime = GETDATE() WHERE DocID = {1}", VERSION, row.Item("DOC_ID")) clsDatabase.Execute_non_Query(upd) If LICENSE_PROXY = True And clsDatabase.DB_PROXY_INITIALIZED Then clsDatabase.Execute_non_Query(upd, True) End If End If Else MsgBox("Could not create a version for file '" & row.Item("FILEPATH") & "'! Check log", MsgBoxStyle.Exclamation) End If Me.Close() Next Me.Close() End Sub End Class