Solved

error come out when i using InStr

Posted on 2006-06-10
7
229 Views
Last Modified: 2012-06-21
Dim test As String = "BB1234/34"
Dim newstring As String = Left(test, InStr(test, "/") -1)

the following error message come out when the above code is used... why?

Compiler Error Message: BC30471: Expression is not an array or a method, and cannot have an argument list.

0
Comment
Question by:kengkit
7 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16877658
Left() in VB.Net is for setting the left edge of a control, its not the same as Left in VB6.

Try:

        Dim test As String = "BB1234/34"
        Dim newString As String = test.Substring(0, InStr(test, "/") - 1)
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16877671
Hi kengkit,

You should use the .Net methods:

        Dim test As String = "BB1234/34"
        Dim newstring As String = test.Substring(0, test.IndexOf("/"))

Cheers!
0
 

Author Comment

by:kengkit
ID: 16879446
Hi emoreau

if i using ur method.. the result return is 'BB1234' but not '34'

wat to do if i gonna get '34' ??
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 33

Expert Comment

by:hongjun
ID: 16879455
Then try this

Dim test As String = "BB1234/34"
Dim newstring As String = test.Substring(test.IndexOf("/") + 1)
0
 
LVL 33

Accepted Solution

by:
hongjun earned 50 total points
ID: 16879458
But then actually, your original example request for output "BB1234".
So I would suggest you DON'T award points to me.


hongjun
0
 

Author Comment

by:kengkit
ID: 16879769
honjun.. u got the point!!  becoz wat i request for is not "BB1234"
0
 
LVL 33

Expert Comment

by:hongjun
ID: 16879989
Got the points but with a C grade?
Please explain.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
Initial get page response times and IIS8 15 55
Deploying to Azure 3 39
Expression Evaluater 3 38
Where is this file? 3 25
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

837 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