Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 293
  • Last Modified:

Help with clearing rows in DataGridView using VB.NET

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
vcharles
Asked:
vcharles
  • 4
  • 3
1 Solution
 
Fernando SotoCommented:
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
 
Kishan ZunjareCommented:
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
 
vcharlesAuthor Commented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Fernando SotoCommented:
Is this a master detail data grid view?
It would help to see the code.
0
 
vcharlesAuthor Commented:
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
 
Fernando SotoCommented:
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
 
vcharlesAuthor Commented:
It works.

Thanks.

V.
0
 
Fernando SotoCommented:
Not a problem, glad I was able to help.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now