Initialize an array of structure in a client app

G

Ghislain Tanguay

Hi,
I have two structures. One containing(EmailMessage) an array of the
other(AttFile). When I try to work with in my VB.NET app iIalways receive an
error off this type Object reference not set to an instance of an object.
This is my code. ANy help please!!!!

Public Structure EmailMessage
Public FichsAttaches() As FichierAttaches
Public DestinataireCourriel As String
Public ExpediteurCourriel As String
Public CCDestinataireCourriel As String
Public SujetCourriel As String
Public MsgCourriel As String
Public ImportanceCourriel As ImportanceCourl
Public FormatCourriel As FormatMessage
Public EncodageCourriel As TypeEncodage

End Structure


Public Structure AttFile
Public NomFichierAttache As String
Public FichierAttache() As Byte
End Structure

Dim objEmail As New localhost.EmailMessage
Dim objFichAtch As New localhost.AttFile
Dim strNomFich As String = "README.txt"

Try

objEmail.ExpediteurCourriel = "blabla"
objEmail.DestinataireCourriel = "blabla"
objEmail.CCDestinataireCourriel = ""
objEmail.SujetCourriel = "Test"
objEmail.MsgCourriel = "Goodddddddddd"
objEmail.FormatCourriel =
CType(System.Enum.Parse(GetType(localhost.FormatMessage),
cboFormat.SelectedItem.ToString()), localhost.FormatMessage)
objEmail.EncodageCourriel =
CType(System.Enum.Parse(GetType(localhost.TypeEncodage),
Me.cboEncodage.SelectedItem.ToString()), localhost.TypeEncodage)
objEmail.ImportanceCourriel =
CType(System.Enum.Parse(GetType(localhost.ImportanceCourl),
cboImpor.SelectedItem.ToString()), localhost.ImportanceCourl)
objFichAtch.FichierAttache = AjouterAtch(strNomFich, "C:\")
objFichAtch.NomFichierAttache = strNomFich
objEmail.FichiersAttaches(0) = objFichAtch ---> Here where the
error occur
******************************************************************

Catch ex As soapException
MessageBox.Show(ex.Message)
End Try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top