Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 498049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:50:25+00:00 2026-05-13T05:50:25+00:00

Currently I have a DataGridView in my app which I fill from my Linq-to-SQL

  • 0

Currently I have a DataGridView in my app which I fill from my Linq-to-SQL classes like so …

    /// <summary>
    /// Delegate to update datagrid, fixes threading issue
    /// </summary>
    private void updateInfo()
    {
        // Linq to datagridview; display all
        var query = from n in dbh.Items select n;
        itemDataGridView.DataSource = query.ToList();
    }

So the problem with this is every time I add new information and run this refresh, the focus of the table changes, meaning if I’m on one row it will switch me to an another one.
And there is an event tied to the change of row so this causes this event to run while the list keeps refreshing.

I don’t but I remember before switching to Linq-to-SQL bounded DataGridView there was a TableAdapter formed, and instead of altering data in the DB you would just insert using this TableAdapter which would automatically refresh the DataGridView in the proper way.

So I’m wondering if there is some other way I should be doing this to each that smooth refresh?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:50:25+00:00Added an answer on May 13, 2026 at 5:50 am

    This doesn’t sound like a L2S issue to me. This sounds more like an issue with whatever grid you are using. All L2S does is to supply your grid with data. It makes sense to me that the current row of the grid would change after a refresh. Is it possible for you to disable the grid, set the current row to be what you want, and then enable the grid? I’ve done this in the past.

    Randy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
I have a .NET windows app. I have a DataGridView which has a few
i am currently working on importing data from excel sheet to sql server.i have
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I currently have a DetailsView in ASP.NET that gets data from the database based
I have a DataGridView bound to the collection, which is changed frequently (not collection
I currently have a DataGridView bound to a LIST that contains 4 fields. The
I currently have the following codes and I would like to add a new
I currently have a DataGridView bound to an sqlite database in c:\temp. I bind
I have a DataGridView which is bound to a DataTable that contains a column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.