Delete multiple columns from datatable

Hi there, I have a data able with 10 columns. I’d like to delete columns 0, 3, 4, 6, 9 from the table (zero based).
I’ve attempted using Invoke Method + RemoveAt with parameter set to

‘In’, Int32 and 0.

This only deletes the first column. When I add more columns to the parameter list, e.g. 0, 3, 4…, I get an error.

Does anyone know how I can drop multiple columns in one go, without having to do iterate through the dt?

Cheers,
Charlie

1 Like

Why not just use filter datatable?

image

Original:

Filtered:
image

2 Likes

Hi @cnjackson

you can do this.

image

Just Sharing. :smiley:

But if you are working with datatable its great to follow @CBlanchard

cheers :smiley:

Happy learning. :smiley:

4 Likes

Thanks @CBlanchard - initially tried that option, because it seemed the best way to do it, but I didn’t get the awesome result you’re getting so I changed tack - will go back and try again .

1 Like

Did you get error @cnjackson in the result ?

cheers :smiley:

Happy learning :smiley:

3 Likes

Thanks everyone, solution marked. The filtering did the trick - really not sure what I missed but it might have been an output variable was incorrectly set.

Amazed at the responses! Thanks again for the speedy help.

2 Likes

No Worries @cnjackson were here to help.

cheers :smiley:

Happy learning :smiley:

4 Likes

Glad it worked mate :slight_smile:.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.