Using instr and other functions like it

Stimulsoft Reports.NET discussion
Post Reply
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Using instr and other functions like it

Post by mmurdock »

How would I use instr and other such functions in a form. Whenever I try it get errors such as 'InStr' is not a member of 'String'

Thanks,

Mat
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Using instr and other functions like it

Post by Brendan »

You can use String.IndexOf() method to replace the InStr function.
You should be able to use any of the string functions to manipulate a string like Substring, Trim, LastIndexOf etc..
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Using instr and other functions like it

Post by mmurdock »

If I do something like this:

dim sample as string = "12-34"

textbox1.text = Instr(sample, "-")


I get this as an error: "Name 'Instr' is not declared."
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Using instr and other functions like it

Post by Brendan »

To use the old VB functions you will need to switch to your Code Tab and add the following line to the end of the Imports list

Code: Select all

Imports Microsoft.VisualBasic
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Using instr and other functions like it

Post by mmurdock »

Hey! that worked!

Thanks!!!!

Mat
Post Reply