On Error GoTo ih
ML(UBound(ML)).UsernameFROM = Username
Form1.GlobalForm.Chat(True, True, System.Drawing.Color.Azure, "usernamefrom added")
ML(UBound(ML)).UsernameTO = cMD(0)
Form1.GlobalForm.Chat(True, True, System.Drawing.Color.BurlyWood, "usernameto added")
ML(UBound(ML)).Message = str.Right(pA(1), Len(pA(1)) - cMD(0))
Form1.GlobalForm.Chat(True, True, System.Drawing.Color.CadetBlue, "message added")
ML(UBound(ML)).Time = System.DateTime.Now
Form1.GlobalForm.Chat(True, True, System.Drawing.Color.DeepPink, "tiem added")
ReDim Preserve ML(UBound(ML) + 1)
SendW("Mail to " & cMD(0) & " added to delivery list")
All goes fine through UsernameTO =, after that I recieve the following error:
QuoteCast from string "craz3d[xl]" to type 'Double' is not valid
My original string was:
craz3d[xl] hi there dood
cMD(0) ends up being craz3d[xl]
My Mail Structure is:
Public Structure MailList
Public UsernameTO As String
Public UsernameFROM As String
Public Message As String
Public Time As String
End Structure
Public ML() As MailList
Help is appreciated.
Oops, problem was a stupid thing.
Forgot to use then length function for cMD(0) when trying to set the message, my bad.
Out of curiousity, why are you using "On Error Goto" in VB.NET? VB.NET uses SEH (Structured Exception Handling), in which you should be using Try...Catch, Try...Finally, or Try...Catch...Finally blocks to handle errors. Using On Error Goto is bad practice in VB.NET.
Another question: Why are you using a Structure and not a Class? If you use a structure, references to the strings need to be duplicated, resulting in a reallocation of 16 bytes of memory for each duplication of a structure, whereas when you use a class, you'll only need to duplicate a reference to that class instance, costing only 4 bytes of memory.
Thank you, I will look into Try & Finally & Catch and also look at using classes instead of structures.