Trouble calling function in BindingSource.Filter expression

Hi!

I'm new on VB2005 Express and looking for some help...

I’m trying to create a telephone agenda in VB2005 to learn the language.

I’m trying to use the string function "Left" to create a filter in my dataset. I create a form with a tabcontrol and one tabpage for each letter of the alphabet. The hole idea is to show only the records with the first letter is the same of the tabpage selected.

To create the filter i use the code below:

Private Sub TabControl1_TabIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.TabIndexChanged

Me.AgendaBindingSource.Filter = "Microsoft.VisualBasic.Left(Name, 1) = '" & Me.TabControl1.SelectedTab.Name.ToString & "'"

End Sub

But when i try to run the code VB returns the message:

"An error occurred creating the form. See Exception.InnerException for details. The error is: The expression contains undefined function call Microsoft.VisualBasic.Left()."

I tried to create a new function called Esq1 to solve the problem but Vb returns the same error message... Below the Esq1 function’s code:

Public Function Esq1(ByVal str As String) As String

Esq1 = Microsoft.VisualBasic.Left(str, 1)

Exit Function

End Function

Can anyone help me with this

PS.: Sorry by my poor english!!!



Answer this question

Trouble calling function in BindingSource.Filter expression

  • Trouble calling function in BindingSource.Filter expression