How do I assign List<String> to "N/A"

Hi,

I have a list variable that contains a list of names from an datatable from one column. The problem im facing is in this excel sheet I am reading (3 sheets) not all sheets are populated some are blank so I need to be able to assign the list to “N/A” whenever the sheet is blank as the end output is the values of the list inside an email…

Any help would be massively appreciated…

@J_Swali,

You can try with linq as follows,

 Dim list As List(Of String) = dtusers.AsEnumerable().[Select](Function(r) if(string.Isnullorempty(r.Field(Of String)("UserCode")), "N/A", r.Field(Of string)("usercode"))).ToList()

Hi thanks for the response,

however i am not using any datatable. I want to be able to assign N/A to a list variable… :frowning:

@J_Swali, may i know from where you want to populate the list. I assumed your source is a datatable due to the highlighted text from your post.

Its okay i found another way to do this :slight_smile: thank you for your effort