FindLastElement Example for C#

//This example uses the predefined variable “LEADRasterView1” of type “AxLEADRasterView” from “"LEADTOOLS Toolkit”. //LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestFindLastElement()
{
   try
   {
      //Find the last image element and display it
      LEADDICOM1.EnableMethodErrors = true;
      //move to last element in Data Set
      LEADDICOM1.MoveLastElement(false);
      LEADDICOM1.FindLastElement((int)LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, false);
      LEADDICOM1.GetBitmapValue(0, 0, (short)LTDICLib.DicomColorOrderConstants.ORDER_RGB, 0);
      LEADRasterView1.Raster.Bitmap = LEADDICOM1.Bitmap;
      LEADDICOM1.Bitmap = 0;
      LEADDICOM1.FindTag(LEADDICOM1.get_CurrentElement().Tag);
      MessageBox.Show("Element: " + LEADDICOM1.get_CurrentTag().Name);
      //find each image
      while (true)
      {
         LEADDICOM1.FindPrevElement(false);
         LEADDICOM1.GetBitmapValue(0, 0, (short)LTDICLib.DicomColorOrderConstants.ORDER_RGB, 0);
         LEADRasterView1.Raster.Bitmap = LEADDICOM1.Bitmap;
         LEADDICOM1.Bitmap = 0;
         LEADDICOM1.FindTag(LEADDICOM1.get_CurrentElement().Tag);
         MessageBox.Show("Element: " + LEADDICOM1.get_CurrentTag().Name);
      }
   }
   catch
   {
      MessageBox.Show("No More Images");
   }
}