我試圖使用一個arraylist作爲String.Format的參數。Vb.NET與ArrayList的String.Format
msg = msg & String.Format("<td>{0}</td>" & _
"<td>{1}</td>" & _
"<td>{2}</td>" & _
"<td>{3}</td>" & _
"<td>{4}</td>" & _
"<td>{5}</td>" & _
"<td>{6}</td>" & _
"<td>{7}</td>" & _
"<td>{8}</td>", param)
,其中一個參數是一個ArrayList和內容因此(從觀察名單中複製):
+ (0) 9 {Integer} Object
+ (1) 3 {Integer} Object
+ (2) 5 {Integer} Object
+ (3) "180" {String} Object
+ (4) 0D {Decimal} Object
+ (5) 6.788D {Decimal} Object
+ (6) #3/13/2009# {Date} Object
+ (7) "2004" {String} Object
+ (8) "" {String} Object
但這代碼拋出一個出現FormatException
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
我錯了,這是可能的使用數組列表?如果可能的話,爲什麼它會拋出這樣的錯誤的任何線索?
感謝
http://msdn.microsoft.com/en-us/library/b1csw23d(v=VS.90).aspx它接受System.Object。這個參考文件基本上沒有用處,只要舉例等等。 雖然工作完美,但謝謝! – 2010-06-01 15:09:33