Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to put Sub functions?
Message
From
24/10/2003 12:48:05
 
 
To
24/10/2003 11:27:23
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00841315
Message ID:
00842264
Views:
31
Michel,

It looks like you're forgetting to instantiate loSpeaker again.
loSpeaker = new MFUG._Function
~~Bonnie

>>No problem.
>
>This morning, that approach doesn't work anymore. I am working on this for an hour and can't figure out why it's like that.
>
>Basically, to provide all the details, I have this line at the top of the Page_Load() wherever my aspx file need to benefit of that function:
>
>
>      Dim loSpeaker As MFUG._Function
>
>
>So, down below, in the Page_Load() event, I can then do this:
>
>
>            ' Speaker 1
>            lcHtml = lcHtml + loSpeaker.AddSpeaker(lnSpeaker1, _
>             loData.Tables("Temp").Rows(lnCompteur)("SpeakerPicture1"), _
>             loData.Tables("Temp").Rows(lnCompteur)("Speaker1"), _
>             loData.Tables("Temp").Rows(lnCompteur)("SpeakerBio1"))
>
>
>But, now, I have "Object reference not set to an instance of an object.".
>
>My function is defined as this:
>
>
>Public Class _Function
>
>
>   ' Add a speaker
>   ' expN1 Speaker ID
>   ' expL1 If the speaker picture is available
>   ' expC1 Speaker name
>   ' expM1 Speaker bio
>   Public Function AddSpeaker(ByVal tnSpeakerID, ByVal tlPicture, ByVal tcName, ByVal tmBio) As String
>      Dim lcHtml As String
>      Dim lcUniversalThread As String
>
>      lcHtml = ""
>
>      ' Universal Thread url
>      lcUniversalThread = "http://www.levelextreme.com/"
>
>      If tnSpeakerID > 0 Then
>         lcHtml = lcHtml + "<TABLE CELLSPACING=0 CELLPADDING=0>"
>         lcHtml = lcHtml + "<TR VALIGN=TOP>"
>         lcHtml = lcHtml + "<TD ALIGN=CENTER WIDTH=90>"
>         If tlPicture Then
>            lcHtml = lcHtml + "<IMG SRC=" + lcUniversalThread + "Photo/" + tnSpeakerID.ToString().PadLeft(6, "0") + ".jpg>"
>         Else
>            lcHtml = lcHtml + "<IMG SRC=" + lcUniversalThread + "Photo/PictureNotAvailable.jpg>"
>         End If
>         lcHtml = lcHtml + "<TD WIDTH=4>"
>         lcHtml = lcHtml + "<TD>"
>         lcHtml = lcHtml + tmBio
>         lcHtml = lcHtml + "</TABLE>"
>      End If
>      lcHtml = lcHtml + "<P>"
>      Return lcHtml
>   End Function
>
>
>End Class
>
>
>Did I define it ok in the Function.vb class? Is the syntax suppose to Public Function AddSpeaker() As String?
>
>Basically, this function returns a string. I think I have it all ok for that part. But, for some kind of reason, whatever is being returned is not a string.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform