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 8858031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:44:01+00:00 2026-06-14T14:44:01+00:00

i have this code: public void LoadData1(String link) { string temp=; int pos =

  • 0

i have this code:

public void LoadData1(String link)
    {
        string temp="";
        int pos = 0;
        for (int x = 0, y = 0; x < link.Length; x++) //separate various code
            if (link[x] == 'y')
            {
                for (temp = ""; y < x; y++)
                    if(link[y]!='y')
                        temp += link[y];
                list[pos] = temp;
                pos++;
                y = x++;
            }
        string nota=list[0];
        for (int a = 0; a < list.Count() && list[a]!=null ; a++,nota=list[a])
        {
            string tempI = "";
            //immagine
            for (int x = 0; x < nota.Count(); x++)
            {
                if (nota[x] == 'p')
                    tempI += '+';
                else
                    tempI += nota[x];
            }

            //nome della pagina
            string temp1 = "";
            int c = tempI.Count();
            if (tempI.Count() > 2)
                if (tempI.ElementAt(2) == 'l') //sol
                {

                    for (int x = 0; x < c; x++)

                        if (x == 3 && tempI.ElementAt(3) == 'd')
                            temp1 += '#';
                        else
                            temp1 += tempI.ElementAt(x);
                }
                else
                {

                    for (int x = 0; x < c; x++)

                        if (x == 2 && tempI.ElementAt(2) == 'd')
                            temp1 += '#';
                        else
                            temp1 += tempI.ElementAt(x);
                }
            else
                temp1 = tempI;

            this.Temp.Add(new ImageText() { Text = temp1, linkImage = "/Accordi/"+tempI+".png" });
        }
        this.IsDataLoaded1 = true;
        this.Temp = new ObservableCollection<ImageText>();
    }

this fill a listbox composed of text and image. but i have this problem: when i fill the listbox with 3 element(for example) it’s go all right, but when i call again the function for fill the listbox with 2 element, the listbox show the two element of call and at the third space show the element of my previous call!! how i can solve this problem?
the listbox is binding by temp, and the string link contains a sequence of code like “DoyDodyRey”

  • 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-14T14:44:02+00:00Added an answer on June 14, 2026 at 2:44 pm

    You’re setting the ‘nth’ element each time you load data, but you’re doing nothing about what’s already there, so if you had a third element on a previous call, and only two on a subsequent one, the third one will still be there.

    It’s simply a matter of clearing it first, or removing excess items afterwards. It’s difficult to see from your code exactly what’s going on, but I think a call to list.Clear() right at the top of the method will probably do the job.

    If you want to simply remove excess items, I think you should be able to add while (list.Count() >= pos) list.Remove(pos); right after your first for loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
I have this code: public void Contacts(string domainToBeTested, string[] browserList, string timeOut, int numberOfBrowsers)
I have this code: public void FileCleanup(List<string>paths) { string regPattern = (@[~#&!%+{}]+); string replacement
I have this code: //choosed a picture public void onActivityResult(int requestCode, int resultCode, Intent
I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int
Lets say I have this code: public static void main(final String [] args) {
I have this code: public void AddNode(string Node) { try { treeView.Nodes.Add(Node); treeView.Refresh(); }
I have this code : public void GenerateWtW() { ExecutorService exec = Executors.newFixedThreadPool(30); ConcurrentHashMap<String,
I have this code: public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) { int
I have this code: public static final String PREFS_NAME = MyPrefsFile; public void onCreate(Bundle

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.