Results 1 to 7 of 7

Thread: refresh datagrid

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2003
    Location
    Kl, Malaysia
    Posts
    8

    refresh datagrid

    Dear All,
    how to refresh the datagrid after i made some changes of by data. i used
    datagrid1.Refresh()
    but it is not working, please help.

    regards
    chowboon

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I am not at my dev machine now to check it, but maybe you have to refresh the underlying currency manager of your datagrid.
    Last edited by Lunatic3; Jun 30th, 2003 at 05:44 AM.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Junior Member
    Join Date
    Dec 2002
    Posts
    28

    refresh datagrid

    solly i didnt get what u mean,,,'refresh the underlying currency manager of your datagrid.' ,,appreciate if u can give me some sample code !


    TIA

    Boon

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    I dont think refreshing the datagrid will work. You have to refresh the underlying datasource. So you would do something like this
    VB Code:
    1. Dim ds as New DataSet()
    2. dataGrid1.DataSource = ds.Tables("mytable").DefaultView
    3.  
    4. 'make changes here
    5.  
    6. Dim tempDs as DataSet = ds.GetChanges()
    7. ds.Merge(tempDs) 'datagrid should be refreshed with new data

  5. #5
    Junior Member
    Join Date
    Dec 2002
    Posts
    28

    refresh datagrid ( resolved)

    just put this into your code

    ds.clear()


    regards

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I will post you the code for refreshing the currency manager when i get home. You dont need to use temporary datasets. You better take a look at databinding concept in windows forms first.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  7. #7
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I think this should work for you.
    VB Code:
    1. Dim cm As CurrencyManager
    2. cm = CType(Me.BindingContext("datagrid data source here"), CurrencyManager)
    3. cm.Refresh
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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