[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Datagrid Leaving Bad Row Behind - How to Prevent this Behavior - Re-posted

Posted on 2005-04-15
7
Medium Priority
?
207 Views
Last Modified: 2010-04-23
I am re-posting my question in case anyone has some fresh ideas.  Any suggestions are greatly appreciated.

Thanks

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21367292.html

Ed
0
Comment
Question by:Edward Stevens
  • 3
  • 3
7 Comments
 
LVL 34

Expert Comment

by:Sancler
ID: 13798111
Have you tried

      if dvMatters.Count = 0 then
            dgMatters.DataSource=Nothing
      else
            dgMatters.DataSource=dvMatters
      end if
      dgMatters.Refresh

Roger
0
 
LVL 14

Accepted Solution

by:
amyhxu earned 80 total points
ID: 13798337
I've posted something to your original question
0
 
LVL 1

Author Comment

by:Edward Stevens
ID: 13837359
Sancler:

I have not tried that but I will as soon as I get back in the office on Monday.  Sorry for the delay in getting back to you.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Edward Stevens
ID: 13876051
Roger,

I have tried your suggestion and that does not produce different results.  The problem persists.  Do you have any other ideas?

Ed
0
 
LVL 34

Expert Comment

by:Sancler
ID: 13877095
Ed

I asked because I know it works (I use it) if the DataSource is a DataTable.  In effect, it provides a DataGrid.Clear method.  I wasn't sure whether it would do so with a DataView as the DataSource.  It seemed worth a try as it was only a couple of lines of code.  But it seems that it doesn't, at least not in that simple a form.

I wonder, though, if rather than just "breaking the link" with the original DataView by setting it to Nothing, you coerced a link to a new empty DataTable, that might work.  Something like

      if dvMatters.Count = 0 then
            dgMatters.DataSource=Nothing
      else
            Dim dt As New DataTable
            dgMatters.DataSource=dt
      end if

You might need to add columns to the new DataTable so it lines up with what the DataView contains and what the DataGrid is expecting.

But that's about all I could suggest.

Roger
0
 
LVL 34

Expert Comment

by:Sancler
ID: 13877270
Ed

Another possibility, perhaps.  Have a look at http://www.dotnet247.com/247reference/msgs/55/278264.aspx.  I'm not sure whether, if at all, it might bear on your problem.  But it does deal with some peculiarities of DataView / DataGrid binding.

Roger
0
 
LVL 1

Author Comment

by:Edward Stevens
ID: 13879722
Roger,

Thanks for all of your assistance.  I was able to resolve the issue from a post on the original question.  I appreciate all of your time spent on this.  Turns out I just had to Unselect the current row and the current cell before updating the data source.

Ed
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question