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.
92 lines
3.4 KiB
92 lines
3.4 KiB
Imports System.Collections.Specialized
|
|
Imports C1.Win.C1TrueDBGrid
|
|
|
|
Public Class frmExport
|
|
Public grid As DataGridView
|
|
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
|
|
If CheckBox2.Checked Then
|
|
CheckBox1.Checked = False
|
|
CheckBox3.Checked = False
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
|
|
If CheckBox1.Checked Then
|
|
CheckBox2.Checked = False
|
|
CheckBox3.Checked = False
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
|
|
If CheckBox3.Checked Then
|
|
CheckBox1.Checked = False
|
|
CheckBox2.Checked = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub frmExport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim res As String
|
|
If CheckBox1.Checked Then 'excel
|
|
Dim dir As String
|
|
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
|
|
res = dir + "\" + DateTime.Now.ToString("yyyyMMdd_hh_mm_ss") + "_export.xlsx"
|
|
Dim dt As New DataTable
|
|
dt = TryCast(grid.DataSource, DataTable)
|
|
Dim dg As New C1TrueDBGrid
|
|
dg.DataSource = dt
|
|
dg.DataMember = dt.TableName
|
|
|
|
dg.ExportToExcel(res)
|
|
End If
|
|
If CheckBox3.Checked Then
|
|
Dim dir As String
|
|
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
|
|
res = dir + "\" + DateTime.Now.ToString("yyyyMMdd_hh_mm_ss") + "_export.csv"
|
|
Dim dt As New DataTable
|
|
dt = TryCast(grid.DataSource, DataTable)
|
|
Dim dg As New C1TrueDBGrid
|
|
dg.DataSource = dt
|
|
dg.DataMember = dt.TableName
|
|
|
|
dg.ExportToDelimitedFile(res, C1.Win.C1TrueDBGrid.RowSelectorEnum.AllRows, ";", "", "", True, System.Text.Encoding.Default.BodyName)
|
|
|
|
End If
|
|
If CheckBox2.Checked Then
|
|
Dim dir As String
|
|
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
|
|
res = dir + "\" + DateTime.Now.ToString("yyyyMMdd_hh_mm_ss") + "_export.xml"
|
|
Dim dt As New DataTable
|
|
dt = TryCast(grid.DataSource, DataTable)
|
|
dt.WriteXml(res)
|
|
|
|
End If
|
|
If RadioButton1.Checked Then
|
|
Dim myProcess As New Process
|
|
myProcess.StartInfo.FileName = res
|
|
myProcess.StartInfo.UseShellExecute = True
|
|
myProcess.StartInfo.RedirectStandardOutput = False
|
|
myProcess.Start()
|
|
myProcess.Dispose()
|
|
End If
|
|
If RadioButton2.Checked Then
|
|
'Process.Start("explorer.exe", System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
|
|
Process.Start("explorer.exe", "/select," & res)
|
|
End If
|
|
If RadioButton3.Checked Then
|
|
Dim email As New clsMailClient
|
|
Dim att As New StringCollection
|
|
att.Add(res)
|
|
email.CreateOutlookMail(clsMailClient.EmpfangerFrom.Dokument, "", att, 0)
|
|
End If
|
|
End Sub
|
|
End Class |