[.NET] Unable to cast object of type

看板Visual_Basic作者 (喵)時間15年前 (2011/01/12 16:54), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/3 (看更多)
請問我已經拉了datarepeater與bindingnagivator到表單上,並指定了bindingsource, 我現在希望能由程式控制datarepeater內text文字格的預設值 所以我參考了以下網址、1樓的回文 http://0rz.tw/vNaoq 但當我實際測試跑程式的時候,程式會停在下面這一行 Dim Table As DataTable = DirectCast(Me.myBindingSource.DataSource, DataTable) 並且出現以下的錯誤訊息: "Unable to cast object of type 'PICData.PICSettingDataSet' to type 'System.Data.DataTable' 請問為什麼datasource也是table卻不能轉換成datatable? 該怎麼改才是對的呢?謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.248.17.41

01/12 20:01, , 1F
DataSet是放DataTable的容器, 這樣用當然不行
01/12 20:01, 1F

01/13 09:07, , 2F
咦 那該如何去CAST出資料來源的TABLE呢?
01/13 09:07, 2F

01/14 14:36, , 3F
請問有人能回答嗎? 囧
01/14 14:36, 3F
文章代碼(AID): #1DBMnV0A (Visual_Basic)
文章代碼(AID): #1DBMnV0A (Visual_Basic)