Solved

array syntax help please

Posted on 2004-10-19
2
200 Views
Last Modified: 2008-03-03
Hi There,

I am trying convert a function that I was using in asp to asp .net, I keep getting the error "overload resolution failed because no accessable 'create instance' can be called without a narrowing conversion". What have I missed?

Sean

    Public Shared Function killChars(ByVal strWords As String)

        Dim newChars As String
        Dim i As Integer

        Dim badChars As Array = Array.CreateInstance(GetType(String), "select", "drop", ";", "--", "insert", "delete", "xp_", "execute")
        newChars = strWords

        For i = badChars.GetLowerBound(0) To badChars.GetUpperBound(0)
            newChars = Replace(newChars, badChars(i), "")
        Next

        killChars = newChars

    End Function
0
Comment
Question by:bullrout
2 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 12346476
Hi bullrout,

as i see from the definition of the CreateInstance in MSDN you can not do that for string objects
have you tried this

Dim badChars() as String = { "select", "drop", ";", "--", "insert", "delete", "xp_", "execute" }

Regards!
B..M
0
 
LVL 5

Author Comment

by:bullrout
ID: 12356175
Works like a treat thanks BM.

Sean
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question