Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:25:52+00:00 2026-06-13T13:25:52+00:00

Public Function Validate(updatedDetailList As List(Of DetailVO)) As Boolean Dim matchFound As Boolean = False

  • 0
Public Function Validate(updatedDetailList As List(Of DetailVO)) As Boolean
  Dim matchFound As Boolean = False

  For Each firstUpdatedDetail In updatedDetailList
    For Each nextUpdatedDetail In updatedDetailList
      If firstUpdatedDetail.PROD_ID.Equals(nextUpdatedDetail.PROD_ID) Then
        matchFound = True
      End If
    Next nextUpdatedDetail
  Next firstUpdatedDetail

  Return matchFound
End Function

I have the updatedDetailList as a list which I want to iterate and get the current and next object value and compare both the values. If You find same PROD_ID in the updatedDetailList then return matchFound as TRUE.

Is there any way to get next object in inner For Loop. Like…

For Each firstUpdatedDetail In **updatedDetailList**
  For Each nextUpdatedDetail In **updatedDetailList.Next**
    If firstUpdatedDetail.PROD_ID.Equals(nextUpdatedDetail.PROD_ID) Then
      matchFound = True
    End If
  Next nextUpdatedDetail
Next firstUpdatedDetail
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:25:53+00:00Added an answer on June 13, 2026 at 1:25 pm

    It seems like you are trying to perform a distinct validation, so every item of updatedDetailList must be unique.

    Without changing your approach (i.e using For loop), here is the code:

    For i = 0 to updatedDetailList.Count - 2
      If updatedDetailList(i).PROD_ID.Equals(updatedDetailList(i+1).PROD_ID) Then
        matchFound = True
        Exit For
      End If
    Next
    

    But there is a faster way to perform same – it uses LINQ:

    Dim matchFound As Boolean = updatedDetailList.Distinct.Count <> updatedDetailList.Count
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public function __construct($input = null) { if (empty($input)){ return false; } and then there's
Having the following class hierarchy: class TheParent{ public function parse(){ $this->validate(); } } class
I have following calss to validate my input elements. class Validator_FormValidator { public function
We have a convention to validate all parameters of constructors and public functions/methods. For
public function create($tableName, $userInput) { $this->db->insert($tableName, $userInput); return $this->db->affected_rows(); } As you see, $this->db->affected_rows();
public function action_adicionar_item() { $lista_item_pedido = array(); $x = 0; if(Session::has('lista_item_pedido')) { foreach(Session::get('lista_item_pedido') as
public function getItemsCollection($useCache = true) { if (is_null($this->_items)) { $this->_items = Mage::getModel('sales/quote_item')->getCollection(); $this->_items->setQuote($this); }
public function test(){ $data = ORM::factory('testdata')->find_all(); Table::factory() ->set_body_data($data) ->set_row_titles('id') ->set_column_titles(Table::AUTO) ->set_callback('format_row', 'row') ->render(true); $this->template->title
public function bmdToStr(bmd:BitmapData,width:int,height:int):String { var encoder:JPEGEncoder = new JPEGEncoder(); var encBytes:ByteArray = encoder.encode(bmd); return
public function configure() { $this->widgetSchema['start_date'] = new sfWidgetFormInput(); $this->widgetSchema['end_date'] = new sfWidgetFormInput(); $this->validatorSchema->setPostValidator( new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.