Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Serialization and deserialization - can't view records in a datagrid nor save in a dataset

Serialization and deserialization - can't view records in a datagrid nor save in a dataset

Scheduled Pinned Locked Moved Visual Basic
jsonhelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BluesEnd
    wrote on last edited by
    #1

    Hi, I’m following a tutorial using serialization/saving records. I can make records, display them ok in a datgridview and then save them ok using serialization. Then I can reopen the programme and reload the dataset from the deserialised file, and show the records ok in the datagrid view - but I cannot add any more records to the datagridview. I’d be grateful for any help/advice/assistance. Regards, Steve Here is my code: Imports System.IO Imports System.Runtime.Serialization Imports System.Runtime.Serialization.Formatters.Binary Public Class Frm_DataEntry Dim ThePoint As New Point(540, 150) Public TheRecord As DataRow Dim ii As Integer Private Sub Frm_DataEntry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Location = ThePoint End Sub Private Sub Tbx01_FirstName_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tbx01_FirstName.Enter Tbx01_FirstName.Clear() Tbx02_LastName.Clear() Tbx03_Phone.Clear() End Sub Private Sub Btn01_Save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn01_Save.Click TheRecord = Frm_Mainform.dt_Table.NewRow TheRecord(Frm_Mainform.dt_Col02_FirstName) = Tbx01_FirstName.Text TheRecord(Frm_Mainform.dt_Col03_LastName) = Tbx02_LastName.Text Frm_Mainform.dt_Table.Rows.Add(TheRecord) Frm01_WithDGV.DGV01.DataSource = Frm_Mainform.ds_Dataset Frm01_WithDGV.DGV01.DataMember = Frm_Mainform.dt_Table.ToString Frm01_WithDGV.DGV01_BS_Col01_PKey.DataPropertyName = Frm_Mainform.dt_Col01_PKey.ToString Frm01_WithDGV.DGV01_BS_Col02_FirstName.DataPropertyName = Frm_Mainform.dt_Col02_FirstName.ToString Frm01_WithDGV.DGV01_BS_Col03_LastName.DataPropertyName = Frm_Mainform.dt_Col03_LastName.ToString Dim ii As Integer ii = Frm_Mainform.dt_Table.Rows.Count MessageBox.Show(ii) End Sub Private Sub Btn02_SaveAndClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn02_SaveAndClose.Click Dim Filename As String = "PermitToWork.pmt" Dim fStream As FileStream Frm01_WithDGV.DGV01.DataSource = Frm_Mainform.ds_Dataset Frm01_WithDGV.DGV01.DataMember = Frm_Mainform.dt_Table.ToString Frm01_WithDGV.DGV01_BS_Col01_PKey.Width = 90 Frm01_WithDGV.DGV01_BS_Col02_FirstName.Width = 125 Frm01_WithDGV.DGV01_BS_Col03_LastName.Width = 125 Frm01_WithDGV.DG

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups