I am new to vb . Now i wan to create a standalone program to send datagrid data via email . izit any way to send the datagrid to email body ?
below is my code.

Public Class Form1


    Dim oLapp As Object
    Dim oItem As Object
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       

        'TODO: This line of code loads data into the 'StockadmDataSet.stock' table. You can move, or remove it, as needed.
        Me.StockTableAdapter.Fill(Me.StockadmDataSet.stock)
        Try
            Me.StockTableAdapter.FillBy(Me.StockadmDataSet.stock)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try


        Try
            Dim oOApp As Outlook.Application
            Dim oOMail As Outlook.MailItem
            Dim oAddSig As Outlook.Inspector

            oOApp = CreateObject("Outlook.Application")
            oOMail = oOApp.CreateItem(Outlook.OlItemType.olMailItem)
            oAddSig = oOMail.GetInspector

            With oOMail
                .To = ""
                .CC = ""
                .Subject = "StockListUpdate"
                .Body = ""
                .Send()

            End With
        Catch ex As Exception
            MsgBox("Email not send .")


        End Try


    End Sub
  
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.