Arguments trop nombreux pour 'Public ReadOnly Default Property Chars(index As Integer) As Char'

Hello everyone ,
i got this error and i didn’t know its meaning and why it shows up can anyone help ?
its comes because of this expression
“DateDiff(DateInterval.Day,DateTime.ParseExact(DateFinPRT.ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture),DateTime.ParseExact(date.Now.ToString(“dd/MM/yyyy”),“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)).ToString”.

and the error is
Arguments trop nombreux pour ‘Public ReadOnly Default Property Chars(index As Integer) As Char’.

i already used the same expression before and it works perfectly

Thanks

@Mery_EL
in a first round you could shorten your code by adding System.Globalization to the imports:
grafik

This allows you to ommit System.Globalization

DateDiff(DateInterval.Day,DateTime.ParseExact(DateFinPRT.ToString,“dd/MM/yyyy”,CultureInfo.InvariantCulture),DateTime.ParseExact(date.Now.ToString(“dd/MM/yyyy”),“dd/MM/yyyy”,CultureInfo.InvariantCulture)).ToString

in a next step you can bring the two date variables and do parsing in advance:

date1 = DateTime.ParseExact(DateFinPRT.ToString,“dd/MM/yyyy”,CultureInfo.InvariantCulture)
date2 = DateTime.ParseExact(date.Now.ToString(“dd/MM/yyyy”),“dd/MM/yyyy”,CultureInfo.InvariantCulture)

but as Now is already a DateTime there is no need to convert now into a string and then parse a date string into datetime

so the statement can be shortened into:
DateDiff(DateInterval.Day,date1,now).ToString

the watch output looks like this:
grafik

For understanding the exception have a look on following:


So the issue was not replicated or occured

Thank you , i tried your solution but the same error still show up even with the short expression


Diff

@Mery_EL
please post a screenshot of your variable definition (variable panels).
Confirm that you have imported System.Globalization
check validation error mesage and post it if it is different


the error is the same as first time

The two dates are both Strings or both DateTime?

DateFinPRT is declared as String but you assign it a value from itself ToString? Can you declare it as DateTime instead?

DateDiff(DateInterval.Day, DateFinPRT, DateTime.Now)

will then be enough.

Hello , thanks
DateFinPRT is extracted from a webpage table , that’s why it is string , and i need to compare the extracted date with today’s date
i tried the datediff function .

If this is a french date:

DateAndTime.DateDiff(DateInterval.Day, DateTime.Parse(DateFinPRT, New System.Globalization.CultureInfo("fr-FR")), DateTime.Now)
1 Like


I tried your solution , i’am still getting the same error

@Pradeep_Shiv Any solutions please ?

Thanks

1 Like

Oups, edited the aswer

1 Like

Thank you very mush , it works

1 Like

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