CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2005
    Posts
    30

    Datagrid not refreshing properly?

    Hy!

    I'm writing some code with VS2005. In my code i have one form and one dialog. With dialog i enter a new record to a database which is access db. On my form i have datagrid with bindings where i show entrys from my database.

    Problem is that when i enter a new record from my dialog, the datagridview is not updated.

    When i load a form i fill a datagridview
    Code:
     
     Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'TODO: This line of code loads data into the 'PocitniskeDataSet.DataTable1' table. You can move, or remove it, as needed.
    
            DataGridView1.Refresh()
            Me.TableAdapter_zl.Fill(Me.PocitniskeDataSet.DataTable1)
    
    End Sub
    Can you please tell me where in my code should i refresh dataset?

  2. #2
    Join Date
    Dec 2005
    Location
    at home :>
    Posts
    21

    Re: Datagrid not refreshing properly?

    create a dataset object and set it as the data source property of the datagrid. any changes made 2 the dataset will be reflected in the datagrid without having 2 write any code. at least, that's how it's done in .NET 2003. good luck

  3. #3
    Join Date
    Dec 2005
    Posts
    30

    Re: Datagrid not refreshing properly?

    I'm showing DataTable1 in DataGridView as DataSource. DataTable1 is an table from my pocitniskeDataSet but still it's not working?

    Any sugestions are very wellcome...

  4. #4
    Join Date
    Dec 2005
    Location
    at home :>
    Posts
    21

    Re: Datagrid not refreshing properly?

    fill the dataadapter before calling the datagrid's refresh method

  5. #5
    Join Date
    Dec 2005
    Posts
    30

    Re: Datagrid not refreshing properly?

    Quote Originally Posted by Winx
    fill the dataadapter before calling the datagrid's refresh method
    Becouse i have just started with vs2005 and becouse i see that you are in a good mood...please Winx try to explain to me a little bit more...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured