Solved

Help with clearing rows in DataGridView using VB.NET

Posted on 2014-02-23
8
283 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now