Pedro Pedro - 1 year ago 285 Question

Why can't I use SendGrid library in

Hello today my boss ordered me to use a smtp service named SendGrid and i wanted to know if it is possible to use SendGrid on a VisualBasic project. From their documentation i only see they have libraries on C# and not in VB, so I thought it wasn't possible.

I have referenced the library and imported the namespace, and tried to create an instance of


Imports SendGrid

Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Button_Click(sender As Object, e As EventArgs)
' Create the mail object first, then add the properties.
Dim myMsg As SendGrid.SendGridMessage() = New SendGrid.SendGridMessage()
End Sub

But the compiler gives me this message

Type 'SendGrid.SendGridMessage' is not defined

My IDE showing reference and code

enter image description here

Answer Source

I got it working by installing the package SendGrid-Net40 (and its dependencies below automatically).

enter image description here

This code will now compile

Dim myMsg As New SendGrid.SendGridMessage()