Concatenation Operator


New member
Mar 7, 2005
Grimsby in United Kingdom
Programming Experience
Sorry about this! such a junior posting but this is my first attempt and I have spent 3 hours trying to fathom out what I have done wrong. Please help.
I saw a snippet of code in the book and understood what it was saying. Thought nevertheless I would try to put it into practice and actually type it all in and display result on the screen. Expected it to output "ASP.NET is neat"

As you have guessed it didn't! Just the word "Answer:"

Please help - here is what I typed and saw in the Web Matrix All code.
I realise I haven't got a clue at the moment but would appreciate your assistance please.

Code:<%@ Page Language="VB" %>
<script runat="server">
Sub word(sender as Object, e as EventArgs)
Dim firstWord as String = "ASP.NET"
Dim secondWord as String = "is"
Dim thirdWord as String = "neat"
Dim sentence as String
sentence = firstWord & " " & secondWord & " " & thirdWord & "."
result.Text= sentence
End Sub
<form runat="server">
<asp:Label id="result" runat="server" Width="229px"></asp:Label>

Is it something I have done wrong with that "Sub word"routine, because I think it might be.

Thanks and apologies for such a basic question, but I have to start somewhere I suppose!
Yes it is the word sub, the reason it doesn't work is it doesn't know when to run the code. You want to do this:

Sub word(sender as Object, e as EventArgs) Handles mybase.load

Handels: tells it to handle an event

mybase.load: is the event (your form loading)


Thank you very much indeed for such a prompt response and for the clarity of your reply. Went straight to the point with very helpful explanations.

I learned something of importance today and I do appreciate your help.
Copied and pasted your instruction; it worked immediately as you indicated.

The reasons behind it I have grasped and now I had better get down to learning past the few initial pages - I guess you will see more postings from me in the months ahead!!

Again - "thanks".