how to avoid late binding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I avoid late binding with the directive strict = tru

My ASP .net-file looks like this

<%@DEBUG=true TRACE=true Strict=false EXPLICIT=true%
..
dim footerValues as Arra
footerValues = split("val1,val2,val3,val4,val5", ","
..
dim strDept as String = footerValues(0
dim strDeptLink as String = footerValues(1
dim strName as String = footerValues(2
dim strNameLink as String = footerValues(3
dim strEMailAddress as String = footerValues(4

The compiler says it doesn't support late binding! But how can I avoid these error messages
 
You can still late bind with reflection, if necessary. I assume this is what
you are getting at. You cannot use late binding with Strict without
reflection, however.

Now, you should be able to use an array like you are without error, but I
would move the code into an event in the CodeBehind rather than place in the
page, ala ASP. I think you will find that it works much better when you do
that.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
I would do something like:

Dim footerValues() As String
footerValues = "val1,val2,val3,val4,val5".Split(","c)

This should by type compatible.

But as was suggested in the other post, try to avoid putting server side
scripts in the .aspx directly. You lose all the compile time support VS.NET
gives you. This also doesn't encourge you to think in OO ways, but
encourages to continue writing code as was done in ASP, that uses
Response.Write for everything.
 
Make footerValues an array of strings instead of just an array of objects...

Patrice
 
Back
Top