Hello Everyone !
I have an unusual problem in my VB.Net Project.
To Understand my Problem you have to read carefully the following.
I am working in a project of VB.NET 2010. I have some data in a datagridview and i want send this data using outlook in a table format just like a grid.
I have successfully convert the data of grid into a datatable and paste it in outlook email body.
the code is following in which i converted the data of grid to a datatable.
Dim Cols As Integer
Cols = 0
While Cols <= MyGrid.ColumnCount - 1
If MyGrid.Columns(Cols).Visible = True Then
DataTable.Columns.Add(MyGrid.Columns(Cols).HeaderText)
End If
Cols = Cols + 1
End While
Dim RowNo As Long = 0
While RowNo <= MyGrid.RowCount - 1
Cols = 0
DataRow = DataTable.NewRow
While Cols <= DataTable.Columns.Count - 1
DataRow(Cols) = MyGrid.Rows(RowNo).Cells(Cols).Value
Cols = Cols + 1
End While
DataTable.Rows.Add(DataRow)
RowNo = RowNo + 1
End While
the data is converted from grid to datatable and then i coppy it to clipboard
Clipboard.SetText(Datatable.Tostring, TextDataFormat.Rtf)
now the problem is that i want to insert two strings also,one string before table and the one string after table.
i use the following code for this
Clipboard.SetText("String One " & Environment.NewLine & Datatable.Tostring & Environment.NewLine & "String Two", TextDataFormat.Rtf)
but as i paste it on the outlook or word page then the string one and two are murged inside the table but i want to look like below.
String One<br />
<br />
"DATA TABLE"<br />
<br />
String Two
Hopefully you got my problem ! Can anyone help me? I Shall be very grateful for this act of kind.