Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all,
am new in vb.net,
i got the below error in my application.
i cant able to find out what is this error exactly
my error is:
Trim is not a member of char

error point is :
accountnumber.Trim

my code is :
VB
Public Function FnAuthenticateUser(ByVal accountnumber As Char, ByVal password As String) As Array

       Dim inputparavalue() As String = {accountnumber.Trim, password.Trim}

End Function

please drop any solution.
thanks in advance...
Posted
Comments
The14thNoah 17-Feb-14 21:20pm    
If you are C# developer and shifted to Vb.Net,you can visit this site. . it will help you a lot in coverting C# to vb.net
http://www.developerfusion.com/

No, Trim is not a member of Char.

Trim applies to Strings - it removes unwanted leading and trailing characters. Char is a fixed size - one character - so it cannot be trimmed.

Why is your account number a Char? if you suspect it may have leading or trailing spaces, the it should be a string. If it's a number, then it probably should be an Integer, which also does not need or support a Trim method.
 
Share this answer
 
Comments
CHill60 17-Feb-14 8:35am    
The 5's from me. Overlap! But your explanation is better
in addition to OriginalGriff, I advice you to try to understand what an error means. It is not just a message, but it is a sentence with a meaning. If it says "Trim is not a member", then it means "Trim is not a member", therefore you cannot use it as if it is a member what you do in your code: "accountNumber(which is char).Trim". what you should do at this point:
1- open msdn and find out your subject in there, then see its properties, methods etc.
2- think of your aim again to see if your code matches your intention.

I think you are not using the Visual Studio IDE. I strongly advice to use it, because it has many advantages as in your case. here it is:
http://www.microsoft.com/en-us/download/details.aspx?id=40787[^]
 
Share this answer
 
The error is quite clear. The char type does not have a property or method called Trim ...

A char represents a single Unicode character ... http://msdn.microsoft.com/en-us/library/7sx7t66b.aspx[^] so there is no concept of "trimming" it

I suspect you meant to pass the parameter like this
ByVal accountnumber As String
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900