By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,826 Members | 815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,826 IT Pros & Developers. It's quick & easy.

Expression does not produce a value: Session error?

P: n/a
I have the following simple code to test if my session is working:

<Script Runat="Server">
Sub LinkButtonGenInfo_Click(s As Object, e As EventArgs)
If txtFirstName.Text <> Nothing Then
Session("firstName")=txtFirstName.Text
End If

If txtFirstName.Text <> Nothing Then
lblYourName.Text=Response.Write(Session("firstName "))
End If
End Sub
</Script>

When I check out the page from the browser, I got the following error
message at Line 10, and I don't know how to fix it. Could you please
give me a hint? Thanks a lot!

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:

Line 8: End If
Line 9: If txtFirstName.Text <> Nothing Then
Line 10: lblYourName.Text=Response.Write(Session("firstName "))
Line 11: End If
Line 12: End Sub

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Response.Write is a Sub (to use VB terminology). As such, it does not return
a value. Since it does not return a value, you cannot assign the result of
executing this method to a property or variable.

<an***********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following simple code to test if my session is working:

<Script Runat="Server">
Sub LinkButtonGenInfo_Click(s As Object, e As EventArgs)
If txtFirstName.Text <> Nothing Then
Session("firstName")=txtFirstName.Text
End If

If txtFirstName.Text <> Nothing Then
lblYourName.Text=Response.Write(Session("firstName "))
End If
End Sub
</Script>

When I check out the page from the browser, I got the following error
message at Line 10, and I don't know how to fix it. Could you please
give me a hint? Thanks a lot!

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:

Line 8: End If
Line 9: If txtFirstName.Text <> Nothing Then
Line 10: lblYourName.Text=Response.Write(Session("firstName "))
Line 11: End If
Line 12: End Sub

Nov 19 '05 #2

P: n/a
lblYourName.Text=Session("firstName")
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

<an***********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following simple code to test if my session is working:

<Script Runat="Server">
Sub LinkButtonGenInfo_Click(s As Object, e As EventArgs)
If txtFirstName.Text <> Nothing Then
Session("firstName")=txtFirstName.Text
End If

If txtFirstName.Text <> Nothing Then
lblYourName.Text=Response.Write(Session("firstName "))
End If
End Sub
</Script>

When I check out the page from the browser, I got the following error
message at Line 10, and I don't know how to fix it. Could you please
give me a hint? Thanks a lot!

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:

Line 8: End If
Line 9: If txtFirstName.Text <> Nothing Then
Line 10: lblYourName.Text=Response.Write(Session("firstName "))
Line 11: End If
Line 12: End Sub

Nov 19 '05 #3

P: n/a
Oh, gosh, the stupid mistake I made makes me blush. But, please
understand that it's been quite a while since I programmed last time.

Thanks a lot, Marina and John who offered the solution.

Marina wrote:
Response.Write is a Sub (to use VB terminology). As such, it does not return
a value. Since it does not return a value, you cannot assign the result of
executing this method to a property or variable.

<an***********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following simple code to test if my session is working:

<Script Runat="Server">
Sub LinkButtonGenInfo_Click(s As Object, e As EventArgs)
If txtFirstName.Text <> Nothing Then
Session("firstName")=txtFirstName.Text
End If

If txtFirstName.Text <> Nothing Then
lblYourName.Text=Response.Write(Session("firstName "))
End If
End Sub
</Script>

When I check out the page from the browser, I got the following error
message at Line 10, and I don't know how to fix it. Could you please
give me a hint? Thanks a lot!

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:

Line 8: End If
Line 9: If txtFirstName.Text <> Nothing Then
Line 10: lblYourName.Text=Response.Write(Session("firstName "))
Line 11: End If
Line 12: End Sub


Nov 19 '05 #4

P: n/a
Oh, gosh, the stupid mistake I made makes me blush. But, please
understand that it's been quite a while since I programmed last time.

Thanks a lot, Marina and John who offered the solution.

Marina wrote:
Response.Write is a Sub (to use VB terminology). As such, it does not return
a value. Since it does not return a value, you cannot assign the result of
executing this method to a property or variable.

<an***********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following simple code to test if my session is working:

<Script Runat="Server">
Sub LinkButtonGenInfo_Click(s As Object, e As EventArgs)
If txtFirstName.Text <> Nothing Then
Session("firstName")=txtFirstName.Text
End If

If txtFirstName.Text <> Nothing Then
lblYourName.Text=Response.Write(Session("firstName "))
End If
End Sub
</Script>

When I check out the page from the browser, I got the following error
message at Line 10, and I don't know how to fix it. Could you please
give me a hint? Thanks a lot!

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:

Line 8: End If
Line 9: If txtFirstName.Text <> Nothing Then
Line 10: lblYourName.Text=Response.Write(Session("firstName "))
Line 11: End If
Line 12: End Sub


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.