We help IT Professionals succeed at work.
Get Started

Help with displaying partial fields in DataGridView

vcharles
vcharles asked
on
63 Views
Last Modified: 2015-09-14
Hi,

I'm using the code below to display data from 1 table to multiple DataGrid, how do I mofiy the code in part A to choose which fields I want to display in each table, the code in part B to display the fields take too long.

Part A:

Dim FilteredDT As DataTable
        Dim DV As New DataView(dtsetlinkBEL.Tables(0), SearchCriteria, Nothing, DataViewRowState.CurrentRows)
        FilteredDT = DV.ToTable

        If FilteredDT.Rows.Count > 0 Then

            C1Screen1.DataSource = FilteredDT
            C1Screen2.DataSource = FilteredDT
            C1Screen3.DataSource = FilteredDT
            C1Screen4.DataSource = FilteredDT

Part B:

  Dim i As Integer
        i = 0
        For i = 14 To 86
            Me.C1Screen1.Columns(i).Visible = False
        Next
       
        For i = 1 To 13
            Me.C1Screen2.Columns(i).Visible = False
        Next
        For i = 23 To 86
            Me.C1Screen2.Columns(i).Visible = False
        Next

        For i = 1 To 22
            Me.C1Screen3.Columns(i).Visible = False
        Next
        For i = 41 To 86
            Me.C1Screen3.Columns(i).Visible = False
        Next

        For i = 1 To 40
            Me.C1Screen4.Columns(i).Visible = False
        Next
Comment
Watch Question
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE