Wednesday, March 12, 2008

Empty Stock Quotes Problem Resolved

I have updated the Stock Quotes web part to fix the problem where the web part appears but without any visible quotes. Apparently in the last few days, Yahoo changed their code so that the CSV file returned is line delimited with a line feed (LF) instead of a carriage-return and line feed (CRLF). As a result, my code was incorrectly parsing the file.

The updated version of the file is available from the main article, or via direct download here.

If you have modified your own copy of the code, just edit this line in the RenderStockQuotes function:

Old:
Dim quotes() As String = Split(stockData, vbCRLF)
New:
Dim quotes() As String = Split(stockData, Chr(10))

4 comments:

John said...

The source code and .dll file are not updated in the download.

Thanks,
John

Scott said...

Not sure what happened there. It's now updated.

stan said...

Thanks!
It works beautifully now.

Christopher said...

Hi Scott,

What could be the problem if its bringing up an error message box saying "Unable to add selected web parts. Yahoo! Finance Stock Quotes: Cannot Import this webpart."
Am trying it on MOSS 2007.
I know that you have not tested it yet on MOSS 2007, but maybe you might have an idea on how to solve this one.

Thanks alot in advance.