You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.4 KiB

Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.Windows.Forms
Public Class frmDokManager_sik
Dim Connectionstring As String
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim co As New SqlConnection
Dim cb As SqlCommandBuilder
Public Sub New(ByVal connstring As String)
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
InitializeComponent()
Me.Connectionstring = connstring
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Private Sub SchliessenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SchliessenToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Me.Close()
End Sub
Private Sub frmDokManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
da = New SqlDataAdapter("Select * from nativvorlage", Connectionstring)
cb = New SqlCommandBuilder(da)
da.Fill(ds, "vorlagen")
Me.C1Daten.DataSource = ds.Tables(0)
Me.C1Daten.DataMember = ds.Tables(0).TableName
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub frmDomainEditor_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If Me.ds.HasChanges Then
Dim msgboxres As MsgBoxResult
msgboxres = MsgBox("Daten wurde verändern. Sollen die Änderungen gespeichert werden?", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Question)
If msgboxres = MsgBoxResult.Cancel Then
e.Cancel = True
Exit Sub
End If
If msgboxres = MsgBoxResult.Yes Then
Try
da.Update(ds, "vorlagen")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End If
Try
Me.co.Close()
da.Dispose()
co.Dispose()
cb.Dispose()
ds.Dispose()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class