Excel export without Interop - vb.net

I'm trying to accomplish export to Excel from a VB.NET (Windows Forms) application.
Unfortunately, I can't use Office Interops because the application should work on every machine - even if there is no Excel installed.
I found the following sample on the Net:
Public Sub ExportDatasetToExcel(ByVal ds As DataSet, Optional ByVal strHeader As String = "Save As")
'Proudly copied from:
'http://www.daniweb.com/software-development/vbnet/threads/368400/write-into-excel-using-oledb-connection#post1583200
Dim fileSave As New SaveFileDialog()
fileSave.Filter = "Excel 97-2003 Workbook (*.xls)|*.xls"
fileSave.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
fileSave.Title = strHeader
fileSave.ShowDialog()
Dim xlsFilePath As String = fileSave.FileName
If xlsFilePath = "" Then
Exit Sub
End If
System.IO.File.Copy(storagePath & "\" & "empty.xls", xlsFilePath)
Cursor.Current = Cursors.WaitCursor
Dim conn As New OleDb.OleDbConnection(String.Format("provider=Microsoft.Jet.OLEDB.4.0; Data Source='{0}';" & "Extended Properties='Excel 8.0;HDR=YES;'", xlsFilePath))
conn.Open()
Dim strTableQ(ds.Tables.Count) As String
Dim i As Integer = 0
'making table query
For i = 0 To ds.Tables.Count - 1
strTableQ(i) = "CREATE TABLE [" & ds.Tables(i).TableName & "]("
Dim j As Integer = 0
For j = 0 To ds.Tables(i).Columns.Count - 1
Dim dCol As DataColumn
dCol = ds.Tables(i).Columns(j)
strTableQ(i) &= " [" & dCol.ColumnName & "] varchar(255) , "
Next
strTableQ(i) = strTableQ(i).Substring(0, strTableQ(i).Length - 2)
strTableQ(i) &= ")"
Dim cmd As New OleDb.OleDbCommand(strTableQ(i), conn)
cmd.ExecuteNonQuery()
Next
'making insert query
Dim strInsertQ(ds.Tables.Count - 1) As String
For i = 0 To ds.Tables.Count - 1
strInsertQ(i) = "Insert Into " & ds.Tables(i).TableName & " Values ("
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
strInsertQ(i) &= "#" & ds.Tables(i).Columns(k).ColumnName & " , "
Next
strInsertQ(i) = strInsertQ(i).Substring(0, strInsertQ(i).Length - 2)
strInsertQ(i) &= ")"
Next
'Now inserting data
For i = 0 To ds.Tables.Count - 1
For j As Integer = 0 To ds.Tables(i).Rows.Count - 1
Dim cmd As New OleDb.OleDbCommand(strInsertQ(i), conn)
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
cmd.Parameters.AddWithValue("#" & ds.Tables(i).Columns(k).ColumnName.ToString(), ds.Tables(i).Rows(j)(k).ToString())
Next
cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
Next
Next
conn.Close()
conn.Dispose()
Cursor.Current = Cursors.Default
End Sub
This code works and exports my dataset to an .xls file.
The problem: I can't open this file while my program is running. It seems my program is still having a handle on this file. I can see it whenever I use the Sysinternals Process Explorer. If I close my program, I can open this file without any problems.
I think I have to destroy some object or just close the file. Please could anyone help a noob to accomplish it?

I don't know if this is the problem, it could. You do not Dispose the OleDbCommand objects. It's possible that it maintains a reference to the file. Try this:
Public Sub ExportDatasetToExcel(ByVal ds As DataSet, Optional ByVal strHeader As String = "Save As")
'Proudly copied from:
'http://www.daniweb.com/software-development/vbnet/threads/368400/write-into-excel-using-oledb-connection#post1583200
Using fileSave As New SaveFileDialog()
fileSave.Filter = "Excel 97-2003 Workbook (*.xls)|*.xls"
fileSave.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
fileSave.Title = strHeader
If fileSave.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim xlsFilePath As String = fileSave.FileName
If xlsFilePath = "" Then Exit Sub
System.IO.File.Copy(storagePath & "\" & "empty.xls", xlsFilePath)
Cursor.Current = Cursors.WaitCursor
Using conn As New OleDb.OleDbConnection(String.Format("provider=Microsoft.Jet.OLEDB.4.0; Data Source='{0}';" & "Extended Properties='Excel 8.0;HDR=YES;'", xlsFilePath))
conn.Open()
Dim strTableQ(ds.Tables.Count) As String
Dim i As Integer = 0
'making table query
For i = 0 To ds.Tables.Count - 1
strTableQ(i) = "CREATE TABLE [" & ds.Tables(i).TableName & "]("
Dim j As Integer = 0
For j = 0 To ds.Tables(i).Columns.Count - 1
Dim dCol As DataColumn
dCol = ds.Tables(i).Columns(j)
strTableQ(i) &= " [" & dCol.ColumnName & "] varchar(255) , "
Next
strTableQ(i) = strTableQ(i).Substring(0, strTableQ(i).Length - 2)
strTableQ(i) &= ")"
Using cmd As New OleDb.OleDbCommand(strTableQ(i), conn)
cmd.ExecuteNonQuery()
End Using
Next
'making insert query
Dim strInsertQ(ds.Tables.Count - 1) As String
For i = 0 To ds.Tables.Count - 1
strInsertQ(i) = "Insert Into " & ds.Tables(i).TableName & " Values ("
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
strInsertQ(i) &= "#" & ds.Tables(i).Columns(k).ColumnName & " , "
Next
strInsertQ(i) = strInsertQ(i).Substring(0, strInsertQ(i).Length - 2)
strInsertQ(i) &= ")"
Next
'Now inserting data
For i = 0 To ds.Tables.Count - 1
For j As Integer = 0 To ds.Tables(i).Rows.Count - 1
Using cmd As New OleDb.OleDbCommand(strInsertQ(i), conn)
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
cmd.Parameters.AddWithValue("#" & ds.Tables(i).Columns(k).ColumnName.ToString(), ds.Tables(i).Rows(j)(k).ToString())
Next
cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
End Using
Next
Next
conn.Close()
Cursor.Current = Cursors.Default
End Using
End If
End Using
End Sub
Also note that a form that you display with ShowDialog() method must be disposed too.

Related

threading in oledb connection, i dont know how to make a thread in this situation. its very slow

getting data from xlsx file and inserting in oledb connection.
i want to make it faster by adding thread or multiple thread if possible. here is my code ... any idea please i need help
Public Sub readEEdata()
Dim eedatapath As String = MainForm.TxtEEData.Text
Dim tempinfo As New infocls
Dim fi As IO.FileInfo = New IO.FileInfo(MainForm.TxtEEData.Text)
Using excelPackage As New ExcelPackage(fi)
Dim firstWorksheet As ExcelWorksheet = excelPackage.Workbook.Worksheets(1)
Dim colCount As Integer = firstWorksheet.Dimension.End.Column
Dim rowCount As Integer = firstWorksheet.Dimension.End.Row
For row As Integer = 2 To rowCount
With tempinfo
MainForm.LblStatus.Text = "Importing EE data: " & row & " " & GetValue(firstWorksheet, "A" & row.ToString)
.ID = GetValue(firstWorksheet, "A" & row.ToString)
.Fname = GetValue(firstWorksheet, "D" & row.ToString)
.lname = GetValue(firstWorksheet, "B" & row.ToString)
.mname = GetValue(firstWorksheet, "E" & row.ToString)
.tinum = GetValue(firstWorksheet, "F" & row.ToString)
If .Fname <> Nothing AndAlso .Fname.Contains("'") Then .Fname = .Fname.Replace("'", "´")
If .lname <> Nothing AndAlso .lname.Contains("'") Then .lname = .Fname.Replace("'", "´")
If .mname <> Nothing AndAlso .mname.Contains("'") Then .mname = .Fname.Replace("'", "´")
End With
If tempinfo.ID <> Nothing And tempinfo.Fname <> Nothing Then
saveEEData(tempinfo)
End If
Next
End Using
Public Sub saveEEData(ByVal infoclass As infocls)
masterConnection = New OleDb.OleDbConnection(connString)
masterConnection.Open()
masterCommand.Connection = masterConnection
masterCommand.CommandText = "Insert into EEData Values('" & infoclass.ID & "', '" & infoclass.lname & "', '" & infoclass.Fname & "','" & infoclass.mname & "','" & infoclass.tinum & "')"
masterCommand.ExecuteNonQuery()
masterConnection.Close()
End Sub
I don't know what you are doing with that label but it just keeps getting overwritten in you loop. The only thing you will see is the last iteration.
There is no need to assign the data to the properties of a class. Just assign them directly to the parameters' values.
Using...End Using block ensure that your database objects are closed and disposed even it there is an error. Always use parameters in you sql statements. You will need to check in your database for the correct datatypes and field sizes. The parameters are added once outside the loop and only the values change inside the loop.
You don't have to worry about single quotes in names when you are using parameters.
This might speed things up because you were opening and closing the connection 10,000 times! Argh!
Public Sub readEEdata()
Dim eedatapath As String = MainForm.TxtEEData.Text
'Don't access the text box a second time, you already have the value
Dim fi As IO.FileInfo = New IO.FileInfo(eedatapath)
Using excelPackage As New ExcelPackage(fi)
Try
Dim firstWorksheet As ExcelWorksheet = excelPackage.Workbook.Worksheets(1)
Dim colCount As Integer = firstWorksheet.Dimension.End.Column
Dim rowCount As Integer = firstWorksheet.Dimension.End.Row
Using cn As New OleDbConnection(connString),
cmd As New OleDbCommand("Insert into EEData Values(#ID, #Lname, #Fname,#Mname,#tinum);", cn)
With cmd.Parameters
.Add("#ID", OleDbType.Integer)
.Add("#Lname", OleDbType.VarChar, 100)
.Add("#Fname", OleDbType.VarChar, 100)
.Add("#Mname", OleDbType.VarChar, 100)
.Add("#tinum", OleDbType.VarChar, 100)
End With
cn.Open()
For row = 2 To rowCount
cmd.Parameters("#ID").Value = GetValue(firstWorksheet, "A" & row.ToString)
cmd.Parameters("#Lname").Value = GetValue(firstWorksheet, "B" & row.ToString)
cmd.Parameters("#Fname").Value = GetValue(firstWorksheet, "D" & row.ToString)
cmd.Parameters("#Mname").Value = GetValue(firstWorksheet, "E" & row.ToString)
cmd.Parameters("#tinum").Value = GetValue(firstWorksheet, "F" & row.ToString)
cmd.ExecuteNonQuery()
Next
End Using
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Using
End Sub
Another approach would be to create and fill a datatable. Then use a DataAdapter to do the Update all at once.

Only column text appears when csv file is imported to datagridview vb.net

This is my first vb.net program, so please bear with me if my question is very mediocre.
Before mentioning my problem, the mechanism of my accounting program is that if the user would input data into the datagridview and export it, so that when he restarts the program, he can import the exported data.
I have imported this .csv file to my datagridview
The problem is that when I have imported it, only column texts would appear like this.
This is the export code that I have used to create the .csv file.
Private Sub ExportToExcelToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExportToExcelToolStripMenuItem.Click
Dim msg1 = "Export Successful"
Dim title = "Excel Export"
MsgBox(msg1, , title)
Try
Dim iexport1 As String = ""
Dim eexport1 As String = ""
For Each C As DataGridViewColumn In Income.Columns
iexport1 &= """" & C.HeaderText & ""","
Next
iexport1 = iexport1.Substring(0, iexport1.Length - 1)
iexport1 &= Environment.NewLine
For Each R As DataGridViewRow In Income.Rows
For Each C As DataGridViewCell In R.Cells
If Not C.Value Is Nothing Then
iexport1 &= """" & C.Value.ToString & ""","
Else
iexport1 &= """" & "" & ""","
End If
Next
iexport1 = iexport1.Substring(0, iexport1.Length - 1)
iexport1 &= Environment.NewLine
Next
For Each C As DataGridViewColumn In Expense.Columns
eexport1 &= """" & C.HeaderText & ""","
Next
eexport1 = eexport1.Substring(0, eexport1.Length - 1)
eexport1 &= Environment.NewLine
For Each R As DataGridViewRow In Expense.Rows
For Each C As DataGridViewCell In R.Cells
If Not C.Value Is Nothing Then
eexport1 &= """" & C.Value.ToString & ""","
Else
eexport1 &= """" & "" & ""","
End If
Next
eexport1 = eexport1.Substring(0, eexport1.Length - 1)
eexport1 &= Environment.NewLine
Next
Dim tw As IO.TextWriter = New IO.StreamWriter(path:="C:\Users\S2009516\Desktop\JanuaryIncome.CSV")
tw.Write(iexport1)
tw.Close()
Dim tw2 As IO.TextWriter = New IO.StreamWriter(path:="C:\Users\S2009516\Desktop\JanuaryExpense.CSV")
tw2.Write(eexport1)
tw2.Close()
Catch ex As Exception
End Try
End Sub
And this is the one I have used for importing csv file.
Private Sub ImportFromExcelToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ImportFromExcelToolStripMenuItem.Click
Dim expenseload1 As String = "C:\Users\S2009516\Desktop\JanuaryExpense.CSV"
Dim incomeload1 As String = "C:\Users\S2009516\Desktop\JanuaryIncome.CSV"
Try
Dim expensereader1 As New StreamReader(expenseload1, Encoding.Default)
Dim incomereader1 As New StreamReader(incomeload1, Encoding.Default)
Dim eline As String = ""
Dim iline As String = ""
Do
eline = expensereader1.ReadLine
iline = incomereader1.ReadLine
If eline Is Nothing Then Exit Do
If iline Is Nothing Then Exit Do
Dim words() As String = eline.Split(",")
Dim words2() As String = iline.Split(",")
Income.Rows.Add("")
Expense.Rows.Add("")
For ix As Integer = 0 To 3
Me.Income.Rows(Income.Rows.Count - 1).Cells(ix).Value = words2(ix)
Me.Expense.Rows(Income.Rows.Count - 1).Cells(ix).Value = words(ix)
Next
Loop
expensereader1.Close()
incomereader1.Close()
Catch ex As Exception
End Try
End Sub
I have no clue on why this is happening... I have followed all the steps in the tutorial video.. Please save my soul... I have been stuck with this for 2 days already.

I am facing an issue during inserting data through datagrid in database

when i insert data through datagrid in a database data's are inserting but an additional blank row is also coming in the data base
My Code:-
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
con()
Dim SNo As String
Dim Name As String
Dim Address As String
For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1
If Me.DataGridView1.Rows.Count = 0 Then
Exit For
End If
SNo = Me.DataGridView1.Rows(i).Cells(0).Value
Name = Me.DataGridView1.Rows(i).Cells(1).Value
Address = Me.DataGridView1.Rows(i).Cells(2).Value
Dim sql As String = "insert into Customer(SNo,Name,Address)values('" & SNo & "','" & Name & "','" & Address & "')"
cmd = New SqlCommand(sql, cn)
cmd.ExecuteNonQuery()
Next
MsgBox("Inserted")
cn.Close()
End Sub
Execute the loop till Datagridview1.rows.count-2
For i As Integer = 0 To Me.DataGridView1.Rows.Count - 2
If Me.DataGridView1.Rows.Count = 0 Then
Exit For
End If
SNo = Me.DataGridView1.Rows(i).Cells(0).Value
Name = Me.DataGridView1.Rows(i).Cells(1).Value
Address = Me.DataGridView1.Rows(i).Cells(2).Value
Dim sql As String = "insert into Customer(SNo,Name,Address)values('" & SNo & "','" & Name & "','" & Address & "')"
cmd = New SqlCommand(sql, cn)
cmd.ExecuteNonQuery()
Next

How to know when vb.net finished export to excel so i can open it

Do you know when my app finished export to excel,
my procedure code like this, the problem is the app open the excel file before export finish
Public Sub ExportDatasetToExcel(ByVal ds As DataSet, ByVal strExcelFile As String)
Try
If System.IO.File.Exists(strExcelFile) = True Then
System.IO.File.Delete(strExcelFile)
End If
fdlExportExcel.Show()
Dim conn As New OleDbConnection(String.Format("provider=Microsoft.Jet.OLEDB.4.0; Data Source='{0}';" & "Extended Properties='Excel 8.0;HDR=YES;'", strExcelFile))
conn.Open()
Dim strTableQ(ds.Tables.Count) As String
Dim i As Integer = 0
'making table query
For i = 0 To ds.Tables.Count - 1
strTableQ(i) = "CREATE TABLE [" & ds.Tables(i).TableName & "]("
Dim j As Integer = 0
For j = 0 To ds.Tables(i).Columns.Count - 1
Dim dCol As DataColumn
dCol = ds.Tables(i).Columns(j)
strTableQ(i) &= " [" & dCol.ColumnName & "] varchar(255) , "
Next
strTableQ(i) = strTableQ(i).Substring(0, strTableQ(i).Length - 2)
strTableQ(i) &= ")"
Dim cmd As New OleDbCommand(strTableQ(i), conn)
cmd.ExecuteNonQuery()
Next
'making insert query
Dim strInsertQ(ds.Tables.Count - 1) As String
For i = 0 To ds.Tables.Count - 1
strInsertQ(i) = "Insert Into " & ds.Tables(i).TableName & " Values ("
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
strInsertQ(i) &= "#" & ds.Tables(i).Columns(k).ColumnName & " , "
Next
strInsertQ(i) = strInsertQ(i).Substring(0, strInsertQ(i).Length - 2)
strInsertQ(i) &= ")"
Next
'Now inserting data
For i = 0 To ds.Tables.Count - 1
For j As Integer = 0 To ds.Tables(i).Rows.Count - 1
Dim cmd As New OleDbCommand(strInsertQ(i), conn)
For k As Integer = 0 To ds.Tables(i).Columns.Count - 1
cmd.Parameters.AddWithValue("#" & ds.Tables(i).Columns(k).ColumnName.ToString(), ds.Tables(i).Rows(j)(k).ToString())
Next
cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
Next
Next
conn.Close()
If conn.State = ConnectionState.Closed Then
fdlExportExcel.Close()
MsgBox("Export Done !, File path = " + strExcelFile)
If System.IO.File.Exists(strExcelFile) = True Then
Process.Start(strExcelFile)
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
If ConnectionState.Open = 1 Then cn.Close()
End Try
End Sub
thx u, already work on this for 2 days still not get the answer

Create New Table on SQL Server with another table's schema

I have a procedure in VB.net that when ran, determines if a table exists or not. If it doesn't exist I want to create a table on SQL Server with the same schema as a local FoxPro table. Is this something that can be done?
Here is what I have so far. Right now it just grabs the Schema from a Visual Foxpro table and displays it. Not sure where to go from here. Any ideas?
Private Sub dwprm01()
Try
Dim tableName As String = "dwprm01"
Dim tableExists As Boolean = False
Dim foxConn As New OleDbConnection("Provider=vfpoledb.1;Data Source=Z:\update_dwprm01\" & tableName & ".DBF;Collating Sequence=general;")
sConn.Open()
Dim restrictions(3) As String
restrictions(2) = tableName
Dim dbTbl As DataTable = sConn.GetSchema("Tables", restrictions)
Console.WriteLine("Checking if " & tableName & " exists")
If dbTbl.Rows.Count = 0 Then
'Table does not exist
tableExists = False
Console.WriteLine(tableName & " does not exist")
Console.WriteLine()
Console.WriteLine("Creating " & tableName)
Dim fSQL = "SELECT * FROM " & tableName
Dim cmd As New OleDbCommand(fSQL, foxConn)
foxConn.Open()
Dim myReader As OleDbDataReader = cmd.ExecuteReader()
Dim schema As DataTable = myReader.GetSchemaTable()
For Each row As DataRow In schema.Rows
For Each col As DataColumn In schema.Columns
Console.WriteLine(col.ColumnName & " = " & row(col).ToString())
Next
Next
myReader.Close()
foxConn.Close()
Else
'Table exists
tableExists = True
Console.WriteLine(tableName & " exists")
End If
dbTbl.Dispose()
sConn.Close()
sConn.Dispose()
Catch ex As Exception
Console.WriteLine(ex.ToString())
End Try
End Sub
Since you've already verified the new table does note exist, you just want to execute a query like this:
SELECT TOP 0 * INTO NewTable FROM OriginalTable
That will create a new table with no rows whose structure matches your original.
I was able to finally figure this out. Here is what I had to do. The commented block will show you different rows in the tables schema. The Case statement is yet to be finished either, but you can add onto this as you run into more datatypes needing to be converted.
Imports System.Data.OleDb
Module prm01_up
Dim sConn As New OleDbConnection("Provider=SQLNCLI10;Server=;Database=;Uid=;Pwd=;")
Sub Main()
Dim foxTables() As String = {"dwprm01", "lkpbrnch", "add_me", "empmastr"}
For Each tableName As String In foxTables
seekAndCreate(tableName)
Next
Console.WriteLine()
Console.WriteLine("Press any key to continue...")
Console.ReadKey()
End Sub
Private Sub seekAndCreate(ByRef tableName As String)
Try
Dim tableExists As Boolean = False
Dim foxConn As New OleDbConnection("Provider=vfpoledb.1;Data Source=Z:\update_dwprm01\" & tableName & ".DBF;Collating Sequence=general;")
sConn.Open()
Dim restrictions(3) As String
restrictions(2) = tableName
Dim dbTbl As DataTable = sConn.GetSchema("Tables", restrictions)
Console.WriteLine("Checking if " & tableName & " exists")
If dbTbl.Rows.Count = 0 Then
'Table does not exist
tableExists = False
Console.WriteLine(tableName & " does not exist")
Console.WriteLine()
Console.WriteLine("Creating " & tableName)
Dim foxDs As New DataSet
Dim fSQL As String = "USE " & tableName
Dim fCmd As New OleDbCommand(fSQL, foxConn)
foxConn.Open()
Dim objDR As OleDbDataReader
objDR = fCmd.ExecuteReader(CommandBehavior.CloseConnection)
Dim schemaTable = objDR.GetSchemaTable()
Dim colName As String = String.Empty
Dim colSize As String = String.Empty
Dim colDataType As String = String.Empty
Dim newDataType As String = String.Empty
Dim allColumns As String = String.Empty
Dim colPrecision As String = String.Empty
Dim colScale As String = String.Empty
Dim createTable As New OleDbCommand
'For Each x As DataRow In schemaTable.Rows
' For Each y As DataColumn In schemaTable.Columns
' Console.WriteLine(y.ColumnName)
' Next
' Console.WriteLine()
'Next
For Each myField As DataRow In schemaTable.Rows
colName = myField(0).ToString
colSize = myField(2).ToString
colDataType = myField(5).ToString
colPrecision = myField(3).ToString
colScale = myField(4).ToString
Select Case colDataType
Case "System.String"
newDataType = "varchar" & "(" & colSize & "), "
Case "System.Decimal"
newDataType = "numeric(" & colPrecision & ", " & colScale & "), "
Case "System.DateTime"
newDataType = "datetime, "
Case "System.Int32"
newDataType = "int,"
Case Else
newDataType = colDataType.ToString()
End Select
allColumns += "[" & colName & "]" & " " & newDataType
Next
Console.WriteLine(allColumns.Substring(0, allColumns.Length - 2))
createTable.Connection = sConn
createTable.CommandType = CommandType.Text
createTable.CommandText = "CREATE TABLE " & tableName & " (" & allColumns & ")"
createTable.ExecuteNonQuery()
foxConn.Close()
Else
'Table exists
tableExists = True
Console.WriteLine(tableName & " exists")
Console.WriteLine()
End If
foxConn.Dispose()
dbTbl.Dispose()
sConn.Close()
Catch ex As Exception
Console.WriteLine(ex.ToString())
End Try
End Sub
End Module