简体   繁体   中英

VB.NET My.Settings Datatable is not saving

i have a datatable that i want to save to a My.Settings Datatable However when i reopen the application i find that the table is not saved

My.Settings.Datatable = someDatatable

is there something wrong with the above statement or something else that i should do?

Assign a TableName , for example:

If My.Settings.Datatable Is Nothing Then
    My.Settings.Datatable = New DataTable
    My.Settings.Datatable.TableName = "Datatable"
    My.Settings.Datatable.Columns.Add("ID", GetType(Int32))
    For i As Int32 = 1 To 1000
        My.Settings.Datatable.Rows.Add(i)
    Next
    My.Settings.Save()
End If

If i reopen the application the datatable still exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM