Operator '&' is not defined

"Hello" & vbCrLf & "Hi Again" = crash

Page 1 of 1

4 Replies - 3921 Views - Last Post: 15 February 2009 - 10:59 PM Rate Topic: -----

#1 vzybilly  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 160
  • Joined: 24-September 08

Operator '&' is not defined

Posted 15 February 2009 - 10:32 PM

Error 1 Operator '&' is not defined for types 'String' and 'System.Exception'. L:\Programming\thingy\Mail.vb 37 20 thingy

not much else i can think to add here but it's making it hard to work...i'm using it like...
Dim Temp As String = "Hello" & vbCrLf & "Hi Again"

Is This A Good Question/Topic? 0
  • +

Replies To: Operator '&' is not defined

#2 prabh  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 3
  • View blog
  • Posts: 381
  • Joined: 27-December 08

Re: Operator '&' is not defined

Posted 15 February 2009 - 10:37 PM

[quote name='vzybilly' date='15 Feb, 2009 - 09:32 PM' post='543816']
Error 1 Operator '&' is not defined for types 'String' and 'System.Exception'. L:\Programming\thingy\Mail.vb 37 20 thingy

not much else i can think to add here but it's making it hard to work...i'm using it like...
Dim Temp As String = "Hello" & vbCrLf & "Hi Again"

can you help me withmd5 hash


View Postvzybilly, on 15 Feb, 2009 - 09:32 PM, said:

Error 1 Operator '&' is not defined for types 'String' and 'System.Exception'. L:\Programming\thingy\Mail.vb 37 20 thingy

not much else i can think to add here but it's making it hard to work...i'm using it like...
Dim Temp As String = "Hello" & vbCrLf & "Hi Again"

please help
Was This Post Helpful? 0
  • +
  • -

#3 vzybilly  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 160
  • Joined: 24-September 08

Re: Operator '&' is not defined

Posted 15 February 2009 - 10:39 PM

i have no clue what a MD5 is...
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Operator '&' is not defined

Posted 15 February 2009 - 10:44 PM

Show the code above and below that line, as that looks fine from the naked eye. One hint though, since you're using VB.NET and not VB6 I would use Environment.NewLine instead of the legacy vbCrLf
Was This Post Helpful? 1
  • +
  • -

#5 vzybilly  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 160
  • Joined: 24-September 08

Re: Operator '&' is not defined

Posted 15 February 2009 - 10:59 PM

well i fixed it now, i have no clue how... but i had it before and got it to work, i'll show both
Try
			mail.From = New MailAddress(F)
			mail.To.Add(T)
			mail.Subject = S
			mail.Body = B
			mail.IsBodyHtml = True
			smtp.Host = H
			smtp.Port = P
			smtp.EnableSsl = True
			smtp.Credentials = New System.Net.NetworkCredential(F, Me.MaskedTextBox1.Text)
			smtp.Send(mail)
			MsgBox("Your Message has beent sent.")
		Catch x As Exception
		   MsgBox("Your Message has not beent sent." & re & "Error:" & re & x)
		End Try

F = Me.TextBox1.Text & Me.Label4


the first was MsgBox("Your Message has not beent sent." & re & "Error:" & re & x) and i fixed that with
Dim temp As String = x.Message
MsgBox(temp)

and the other i just forgot to put .text at the end... i've never seen that error before in 2 years...

i'll also try the newline thing...

also if you know the ports for email clients like yahoo and aol or know of a place to get them could you let me know?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1