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

  • SEARCH
  • Home
  • 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 6760263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:02:42+00:00 2026-05-26T14:02:42+00:00

— EDIT — Worth to point out. While having a problem with different homework

  • 0

— EDIT —

Worth to point out. While having a problem with different homework problem I see than I am able to use separate objects as an entry (which I probably should do). This would make working on my final problem much easier. This is a problem that might be usefull for me.

I am trying to display data to text box using foreach loop. The data should be displayed coresponding to the selection of combo box. For example if I want to display PC I should see only UserName and Password and if I add another entry for example WebSite I should see previous entry in it’s format and new entry with fields URL, Username, and Password. I have tried IF-statement in my previous question but didn’t seem to work properly.

            StringBuilder sb = new StringBuilder();
            foreach (AddEntry list in addedEntry)
            {
                sb.AppendLine();
                sb.AppendLine("URL: " + list.URL);
                sb.AppendLine("Software Name: " + list.SoftwareName);
                sb.AppendLine("Serial Code: " + list.SerialCode);
                sb.AppendLine("User Name: " + list.UserName);
                sb.AppendLine("Password: " + list.Password);
                sb.AppendLine();
            }

            mainWindow.ChangeTextBox = sb.ToString();

Regards.

  • 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-05-26T14:02:43+00:00Added an answer on May 26, 2026 at 2:02 pm
    StringBuilder sb = new StringBuilder();
    foreach (AddEntry list in addedEntry)
    {
        sb.AppendLine();
        if (!string.IsNullOrEmpty(list.URL))
        sb.AppendLine("URL: " + list.URL);
        if (!string.IsNullOrEmpty(list.SoftwareName))
        sb.AppendLine("Software Name: " + list.SoftwareName);
        if (!string.IsNullOrEmpty(list.SerialCode))
        sb.AppendLine("Serial Code: " + list.SerialCode);
        if (!string.IsNullOrEmpty(list.UserName))
        sb.AppendLine("User Name: " + list.UserName);
        if (!string.IsNullOrEmpty(list.Password))
        sb.AppendLine("Password: " + list.Password);
        sb.AppendLine();
    }
    

    mainWindow.ChangeTextBox = sb.ToString();

    2nd Option

    Add following method to AddEntry class

      public override string ToString() 
      {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine();
        if (!string.IsNullOrEmpty(this.URL))
        sb.AppendLine("URL: " + list.URL);
        if (!string.IsNullOrEmpty(this.SoftwareName))
        sb.AppendLine("Software Name: " + this.SoftwareName);
        if (!string.IsNullOrEmpty(this.SerialCode))
        sb.AppendLine("Serial Code: " + this.SerialCode);
        if (!string.IsNullOrEmpty(this.UserName))
        sb.AppendLine("User Name: " + this.UserName);
        if (!string.IsNullOrEmpty(this.Password))
        sb.AppendLine("Password: " + this.Password);
        sb.AppendLine();
        return sb.ToString();
      }
    

    then you can show all the added Entry as below

    StringBuilder sb = new StringBuilder();
    foreach (AddEntry entry in addedEntry)
    {
        sb.Append(entry.ToString());
    }
    
    mainWindow.ChangeTextBox = sb.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

— or — Is there a difference between these? Is one better-supported than the
I'm having a simple problem toggling between +/- characters which prepend a link which
I'm using some of Firefox's specially-defined values for cursor, in particular -moz-zoom-in -moz-zoom-out -moz-grab
I am looking for a way to format a floating point number dynamically in
I am currently running into a problem where an element is coming back from
I need to make a web page with Wicket that lays out the following
We're building an app, our first using Rails 3, and we're having to build
We have different types of hyphens/dashes (in some text) populated in db. Before comparing
While conducting some experiments in Java, my project supervisor reminded me to seed each
I'm using a DatePicker ( org.apache.wicket.extensions.yui.calendar.DatePicker — Javadoc ) in a form. The form

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.