Solved

Help with clearing rows in DataGridView using VB.NET

Posted on 2014-02-23
8
286 Views
Last Modified: 2014-02-24
Hi,

When I click rows on Grid1 I display results in Grid2, but when I uncheck the rows in Grid1, how do I clear the rows in Grid2?

Thanks,

Victor
0
Comment
Question by:vcharles
  • 4
  • 3
8 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39881537
Hi Victor;

Is this a web form a Windows form a WPF application?
Is this a master detail data grid view?
It would help to see the code.
0
 
LVL 7

Expert Comment

by:Kishan Zunjare
ID: 39881541
You no need to clear rows of Grid2, if you don't want to show Grid2, You can just hide/show Grid2 on click of checkbox of Grid1.

Or here you can use Expand/collapse functionality;
http://www.aspsnippets.com/Articles/Nested-GridView-Example-in-ASPNet-using-C-and-VBNet.aspx

-Kishan
0
 

Author Comment

by:vcharles
ID: 39881558
Hi,

It is a windows application inn VS 2010, using the DataGridView. I would prefer to clear the rows than hide the Grid if possible.

V.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39882271
Is this a master detail data grid view?
It would help to see the code.
0
 

Author Comment

by:vcharles
ID: 39882434
Hi,

Below is the code I'm using in c1valuechange event of C1Screen2 to load C1Screen3.

 Dim FilteredDTA As DataTable
        Dim DVA As New DataView(dtsetLinkAOP5.Tables(0), SearchCriteria, Nothing, DataViewRowState.CurrentRows)
        FilteredDTA = DVA.ToTable
        If FilteredDTA.Rows.Count > 0 Then
        Me.C1Screen3.DataSource = FilteredDTA.DefaultView.ToTable(True, New String() {"COUNTRY", "FIF", "NAS", "QUANTITY", "PC"})
End If
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39882694
To your question, "When I click rows on Grid1 I display results in Grid2, but when I uncheck the rows in Grid1, how do I clear the rows in Grid2?", try the following :

Grid2.DataSource = Nothing
0
 

Author Comment

by:vcharles
ID: 39882733
It works.

Thanks.

V.
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39882740
Not a problem, glad I was able to help.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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