473,396 Members | 2,018 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,396 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
Jul 21 '05 #1
2 1870
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
Jul 21 '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

Jul 21 '05 #3

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

Similar topics

4
by: Robert Ferrell | last post by:
I have a style question. I have a class with a method, m1, which needs a helper function, hf. I can put hf inside m1, or I can make it another method of the class. The only place hf should ever...
4
by: Michael Farber | last post by:
Not sure if this is the right group for this but anyways... I've got an ASP web application that uses a Visual Basic component to do some work. I instantiate the component in asp and then...
11
by: RichN | last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an Intel(R) Fortran compiler for MVS .NET My fortran sourcecode already existed. I started a new fortran project and chose to...
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...
1
by: Tran Hong Quang | last post by:
Hello, What is helper function concept? I am new to C. Thanks Tran Hong Quang
7
by: pagarwalla1234 | last post by:
Hi, Below is the part of code from a test FW I am working on : sub run { my $self = shift; $self->SUPER::LogDirGen( ); # priti my $config = new Config::Simple( $self->{ config }...
0
by: beebelbrox | last post by:
Greetings, I am stuck on this. Is it possible to have a subroutine in one database call a subroutine in a second database. my attempt below produces an error. The error i get is "compile error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.