Start New Discussion within our Software Development Community

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
This article has been dead for over six months. Start a new discussion instead.