GetExtension is not a member of string

Hello Everyone,
How can I remove this error, plz help?

Hi @tushar,

Please change the expression as Path.GetExtension(strFileName)

Warm regards,
NImin

Thanks For the reply @nimin but this ain’t working.

Hi @tushar,

Could you please share the error that you are getting now?

Hi @nimin
It’s still the same.

Change strFileExtension Data type from genericvalue to string and it should be
strFileExtension = Path.GetExtension(strFilePath)

Hi,

what is the datatype of your strFilePath variable? if its Generic value change it to string

make strFileExtension variable string variable

Your strFilePath is Generic type variable thats wat you are getting that error. instead of strFilePath use just Path.Extension(“path”)

Hi @Emman_Pelayo
As you said I did the same but nothing changed.
And Variable type is string.

Hi @Abisha,
It’s not working.

Based on your several screenshot, you are assigning
strFileExtension = strFilePath.GetExtension(strFileName) -this is incorrect

It should be
strFileExtension = Path.GetExtension(strFileName) - (Path is a class, not strFilePath)

2 Likes

Pls find the sample

FileName is String variable
strFileExtension is String varible

path.getExtension(FileName)

image

You are using strFilePath instead of Path

1 Like

Thank you, all of you for the reply, but these methods aren’t working. I tried each and every method.

Thank You so much to all of you for your time but i got the solution and here it is.
Regards
Tushar
Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.