473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Subroutine /helper function error

I'm using a subroutine/helper function display an image (the image
would be displayed inside a datalist control's <itemtemplate> )

<script language="VB" runat="server">
Public Sub checkforimg(ByVal Imagesubprod1 As String)
If Imagesubprod1 <> "" then
response.write(Imagesubprod1)
Else
response.write("nbsp;")
End If
End Sub
</script>

.... but I get an "Overload resolution failed because no accessible
'ToString' can be called with these arguments:" error when it comes
time to check for the image as follows.

<%# checkforimg(DataBinder.Eval(Container.DataItem,
"Imagesubprod1"))%>

When I form the header for the sub as follows:
Public Sub checkforimg(ByVal Imagesubprod1 As String) As string

...i get an "Expected end of statement " error on this line
Nov 18 '05 #1
2 927
On 10 Jun 2004 11:55:42 -0700, Chumley the Walrus <sp*******@yahoo.com>
wrote:
I'm using a subroutine/helper function display an image (the image
would be displayed inside a datalist control's <itemtemplate> )

<script language="VB" runat="server">
Public Sub checkforimg(ByVal Imagesubprod1 As String)
If Imagesubprod1 <> "" then
response.write(Imagesubprod1)
Else
response.write("nbsp;")
End If
End Sub
</script>

... but I get an "Overload resolution failed because no accessible
'ToString' can be called with these arguments:" error when it comes
time to check for the image as follows.

<%# checkforimg(DataBinder.Eval(Container.DataItem,
"Imagesubprod1"))%>


looks like it's having trouble converting the value you're passing in thru
databinding to a String. If you have Option Strict on, you might try
either casting the value in the databinding statement to a string before
passing it in, or change the parameter in your method above to an Object
and then cast it inside the function itself.

Otherwise verify the value in your datasource is truly capable of being a
string.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
IE does not support inline images, so you code should be writing something
like: <img src=url> not the binary image.

-- bruce (sqlwork.com)
"Chumley the Walrus" <sp*******@yahoo.com> wrote in message
news:1e*************************@posting.google.co m...
I'm using a subroutine/helper function display an image (the image
would be displayed inside a datalist control's <itemtemplate> )

<script language="VB" runat="server">
Public Sub checkforimg(ByVal Imagesubprod1 As String)
If Imagesubprod1 <> "" then
response.write(Imagesubprod1)
Else
response.write("nbsp;")
End If
End Sub
</script>

... but I get an "Overload resolution failed because no accessible
'ToString' can be called with these arguments:" error when it comes
time to check for the image as follows.

<%# checkforimg(DataBinder.Eval(Container.DataItem,
"Imagesubprod1"))%>

When I form the header for the sub as follows:
Public Sub checkforimg(ByVal Imagesubprod1 As String) As string

..i get an "Expected end of statement " error on this line

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chumley the Walrus | last post by:
I'm using a subroutine/helper function display an image (the image would be displayed inside a datalist control's <itemtemplate> ) <script language="VB" runat="server"> Public Sub...
2
by: Chumley the Walrus | last post by:
I'm using a subroutine/helper function display an image (the image would be displayed inside a datalist control's <itemtemplate> ) <script language="VB" runat="server"> Public Sub...
2
by: Chumley the Walrus | last post by:
I'm using a subroutine/helper function display an image (the image would be displayed inside a datalist control's <itemtemplate> ) <script language="VB" runat="server"> Public Sub...
2
by: Chumley the Walrus | last post by:
I'm using a subroutine/helper function display an image (the image would be displayed inside a datalist control's <itemtemplate> ) <script language="VB" runat="server"> Public Sub...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.