Array error in c# programming

Asked By 800 points N/A Posted on -
qa-featured

Hello brothers and sisters,

I am a developer having at the start of my career. I am developing an application in dot net using C# that will work on the different aspects of the images. One of its functionality is to shows the pictures in the slide show. I am writing my own module for achieving that functionality.

I am facing a problem during execution of this module and I am unable to figure out what is causing this error to happen. The module contains the next and previous buttons that contains the code that moves the loaded images forward or backward one at a time.

Guide me in this regard.

The error says.

Failed to compare two elements in the array.

 

Error

Failed to compare two elements in the array.

Error Details

=== DETAILS===

Failed to compare two elements in the array.

=== CORRECTIVE ACTION===

No corrective action found

SHARE
Answered By 0 points N/A #118984

Array error in c# programming

qa-featured

Hi VKing,

Please try the following code:

This is source for next button: .ascx.cs


protected void Next_Routine(object sender, CommandEventArgs e)
        {
            EgtFlashController objEgtFlashs = new EgtFlashController();
            List<EgtFlashInfo> lstItems = objEgtFlashs.GetEgtFlashs(this.ModuleId);
            lstItems.Sort();
            int Sorter = 0;
            foreach (EgtFlashInfo obj in lstItems)
            {
                obj.SortId = Sorter;
                objEgtFlashs.UpdateEgtFlash(obj);
                Sorter++;
            }

            for (int i = 0; i < lstItems.Count; i++)
            {
                EgtFlashInfo obj = (EgtFlashInfo)lstItems[i];
                if (obj.ItemId == Convert.ToInt32(e.CommandArgument.ToString()))
                {
                    if (i == (lstItems.Count – 1))
                    {
                        break;
                    }
                    obj.SortId++;
                    objEgtFlashs.UpdateEgtFlash(obj);

                    obj = (EgtFlashInfo)lstItems[i + 1];
                    obj.SortId–;
                    objEgtFlashs.UpdateEgtFlash(obj);
                }
            }

            //refresh cache
            SynchronizeModule();

            ExportXml(false);

            Response.Redirect(Request.Url.AbsoluteUri, true);
        }

Related Questions