看板 Visual_Basic 關於我們 聯絡資訊
※ 引述《mindscold (喵)》之銘言: : 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? : 該怎麼改才是對的呢?謝謝 Try Dim ds as DataSet = CType(Me.myBindingSource.DataSource, DataSet) Catch ex As Exception MsgBox(ex.Message) End Try Dim dt1 as DataTable = ds.Tables(0) -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 112.104.148.39
horngsh:忘了Scope限制,請把ds改放在Try 上方,如Dim ds as DataSet 01/15 19:29
horngsh:然後Try下面用ds = CType(....) 01/15 19:29
mindscold:感謝,我馬上試試 01/17 08:23