When using this as indicated and trying to set it to accept multiple formats, it bombs out with the error: Overload resolution failed because no accessible 'TryParse' accepts this number of arguments The code looks like this: ok = Decimal.TryParse(tbIll.Text, _ NumberStyles.AllowCurrencySymbol, NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) Any ideas? I did in fact place the required: Imports System.Globalization at the top too. Thanks Steffan
[quoted text, click to view] On Feb 10, 9:06 pm, "Steffan A. Cline" <stef...@hldns.com> wrote: > When using this as indicated and trying to set it to accept multiple > formats, it bombs out with the error: > > Overload resolution failed because no accessible 'TryParse' accepts this > number of arguments > > The code looks like this: > > ok = Decimal.TryParse(tbIll.Text, _ > NumberStyles.AllowCurrencySymbol, > NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) >
Try: ok = Decimal.TryParse (tbIll.Text, _ NumberStyles.AllowCurrencySymbol Or _ NumberStyles.AllowDecimalPoint Or _ NumberStyles.Currency, System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat, temp) -- Tom Shelton
in article 1171172699.667711.142740@v45g2000cwv.googlegroups.com, Tom Shelton at tom_shelton@comcast.net wrote on 2/10/07 10:44 PM: [quoted text, click to view] > On Feb 10, 9:06 pm, "Steffan A. Cline" <stef...@hldns.com> wrote: >> When using this as indicated and trying to set it to accept multiple >> formats, it bombs out with the error: >> >> Overload resolution failed because no accessible 'TryParse' accepts this >> number of arguments >> >> The code looks like this: >> >> ok = Decimal.TryParse(tbIll.Text, _ >> NumberStyles.AllowCurrencySymbol, >> NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) >> > > Try: > > ok = Decimal.TryParse (tbIll.Text, _ > NumberStyles.AllowCurrencySymbol Or _ > NumberStyles.AllowDecimalPoint Or _ > NumberStyles.Currency, > System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat, > temp) > > -- > Tom Shelton >
Tom, Thanks, this worked great. Not sure why the documentation didn't clarify this any better. -Steffan
in article ejEAPRuTHHA.4276@TK2MSFTNGP02.phx.gbl, Göran Andersson at guffa@guffa.com wrote on 2/12/07 1:27 PM: [quoted text, click to view] > Steffan A. Cline wrote: >> in article 1171172699.667711.142740@v45g2000cwv.googlegroups.com, Tom >> Shelton at tom_shelton@comcast.net wrote on 2/10/07 10:44 PM: >> >>> On Feb 10, 9:06 pm, "Steffan A. Cline" <stef...@hldns.com> wrote: >>>> When using this as indicated and trying to set it to accept multiple >>>> formats, it bombs out with the error: >>>> >>>> Overload resolution failed because no accessible 'TryParse' accepts this >>>> number of arguments >>>> >>>> The code looks like this: >>>> >>>> ok = Decimal.TryParse(tbIll.Text, _ >>>> NumberStyles.AllowCurrencySymbol, >>>> NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) >>>> >>> Try: >>> >>> ok = Decimal.TryParse (tbIll.Text, _ >>> NumberStyles.AllowCurrencySymbol Or _ >>> NumberStyles.AllowDecimalPoint Or _ >>> NumberStyles.Currency, >>> System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat, >>> temp) >>> >>> -- >>> Tom Shelton >>> >> >> Tom, >> >> Thanks, this worked great. Not sure why the documentation didn't clarify >> this any better. >> >> -Steffan >> > > I think that it's clear enough... > > From the documentation of decimal.TryParse: > > "style: > A bitwise combination of NumberStyles values that indicates the > permitted format of s. A typical value to specify is Number." > > There is also an example clearly showing this.
Can you post a link to where you saw this? I must have missed the example. I also searched the web and saw several examples but none of which worked. The book that our school is teaching from even had examples that didn't work. Seems to be some inconsistencies. Thanks Steffan
[quoted text, click to view] Steffan A. Cline wrote: > in article 1171172699.667711.142740@v45g2000cwv.googlegroups.com, Tom > Shelton at tom_shelton@comcast.net wrote on 2/10/07 10:44 PM: > >> On Feb 10, 9:06 pm, "Steffan A. Cline" <stef...@hldns.com> wrote: >>> When using this as indicated and trying to set it to accept multiple >>> formats, it bombs out with the error: >>> >>> Overload resolution failed because no accessible 'TryParse' accepts this >>> number of arguments >>> >>> The code looks like this: >>> >>> ok = Decimal.TryParse(tbIll.Text, _ >>> NumberStyles.AllowCurrencySymbol, >>> NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) >>> >> Try: >> >> ok = Decimal.TryParse (tbIll.Text, _ >> NumberStyles.AllowCurrencySymbol Or _ >> NumberStyles.AllowDecimalPoint Or _ >> NumberStyles.Currency, >> System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat, >> temp) >> >> -- >> Tom Shelton >> > > Tom, > > Thanks, this worked great. Not sure why the documentation didn't clarify > this any better. > > -Steffan >
I think that it's clear enough... From the documentation of decimal.TryParse: "style: A bitwise combination of NumberStyles values that indicates the permitted format of s. A typical value to specify is Number." There is also an example clearly showing this. -- Göran Andersson _____
[quoted text, click to view] Steffan A. Cline wrote: > in article ejEAPRuTHHA.4276@TK2MSFTNGP02.phx.gbl, Göran Andersson at > guffa@guffa.com wrote on 2/12/07 1:27 PM: > >> Steffan A. Cline wrote: >>> in article 1171172699.667711.142740@v45g2000cwv.googlegroups.com, Tom >>> Shelton at tom_shelton@comcast.net wrote on 2/10/07 10:44 PM: >>> >>>> On Feb 10, 9:06 pm, "Steffan A. Cline" <stef...@hldns.com> wrote: >>>>> When using this as indicated and trying to set it to accept multiple >>>>> formats, it bombs out with the error: >>>>> >>>>> Overload resolution failed because no accessible 'TryParse' accepts this >>>>> number of arguments >>>>> >>>>> The code looks like this: >>>>> >>>>> ok = Decimal.TryParse(tbIll.Text, _ >>>>> NumberStyles.AllowCurrencySymbol, >>>>> NumberStyles.AllowDecimalPoint, NumberStyles.Currency, temp) >>>>> >>>> Try: >>>> >>>> ok = Decimal.TryParse (tbIll.Text, _ >>>> NumberStyles.AllowCurrencySymbol Or _ >>>> NumberStyles.AllowDecimalPoint Or _ >>>> NumberStyles.Currency, >>>> System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat, >>>> temp) >>>> >>>> -- >>>> Tom Shelton >>>> >>> Tom, >>> >>> Thanks, this worked great. Not sure why the documentation didn't clarify >>> this any better. >>> >>> -Steffan >>> >> I think that it's clear enough... >> >> From the documentation of decimal.TryParse: >> >> "style: >> A bitwise combination of NumberStyles values that indicates the >> permitted format of s. A typical value to specify is Number." >> >> There is also an example clearly showing this. > Can you post a link to where you saw this? I must have missed the example. I > also searched the web and saw several examples but none of which worked. The > book that our school is teaching from even had examples that didn't work. > Seems to be some inconsistencies. > > Thanks > > Steffan >
MSDN: Decimal.TryParse(String, NumberStyles, IFormatProvider, Decimal) http://msdn2.microsoft.com/en-gb/library/ew0seb73.aspx -- Göran Andersson _____
Don't see what you're looking for? Try a search.
|