Solved

Help with clearing rows in DataGridView using VB.NET

Posted on 2014-02-23
8
285 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 62

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 62

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 62

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 62

Expert Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
EF5: Question about Metadata Artifact Processing 4 15
SQL LINE CONTINUATION ISSUE 12 33
Alert on Server memory 2 22
RLDC Reporting in Visual studio 11 16
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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