I have two columns. One column contains string values and another column contains decimal values. I want to select the decimal value by selecting the string value.
string decimal
Jewel 10
Hasan 20
How do I select Jewel so it will return 10?
The List class is used to store generic types of collections objects. By using a generic class on the list, we can store one type of object. The List size can be dynamically different depending on the need of the application, such as adding, searching or inserting elements into a list.
By using Contains() method, we can check whether the specified element exists in the list or not. In case, if it exists it will return True otherwise False.
A Predicate is a function object that receives arguments, and always returns a Boolean. It tells us whether something is true or false. Here We see 2 Predicates. The first tells us whether an integer is positive—it returns True if the value is greater than or equal to 0.
Try this:
Dim selectedValues As List(Of InvoiceSOA)
selectedValues = DisputeList.FindAll(Function(p) p.ColumnName = "Jewel")
Or, if you need the first occurence of "Jewel" use this:
Dim selectedValue As InvoiceSOA
selectedValue = DisputeList.Find(Function(p) p.ColumnName = "Jewel")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With