i hve create 1 listview and all data from accessdatabase (using oledbconnection)

in database hve 4 column, so in listview 4 column..
can i view only 2 column in listview, example only column 1 & 2 only in listview..

i using this code

ListView.Items.Clear()
        While (myDR.Read())
            With ListView.Items.Add(myDR("column1"))
                .SubItems.Add(myDR("column2"))
                .SubItems.Add(myDR("column3"))
                .SubItems.Add(myDR("column4"))
               

            End With

        End While

if i remove code in line 5 and 6 i will get error...
anyone

can i view only 2 column in listview, example only column 1 & 2 only in listview..

Yes

if i remove code in line 5 and 6 i will get error...

why ?

If you want to display only 2 columns why you need to add code for 4 columns ?

It may happen my table contains 200 columns but not compulsory to display all the columns.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.