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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:22:08+00:00 2026-05-18T02:22:08+00:00

I have a program which is able to retrieve various registry values using C#

  • 0

I have a program which is able to retrieve various registry values using C# codes which was compiled and created using VS 2010.

However the problem arises when I tried to display the results retrieved from the Windows Registry into a rich text box within a form.

The form only shows 1 line which is the last value in the Array that contains the results.

Please do give some advice on the codes. Thanks!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Syscrawl
{
public partial class FTK_Menu_Browsing_History : Form
{
    public FTK_Menu_Browsing_History()
    {
        InitializeComponent();
    }

    private void buttonFileHistory_Click(object sender, EventArgs e)
    {
        this.Hide();
        FTK_Menu_File_History mfh = new FTK_Menu_File_History();
        mfh.ShowDialog();
        this.Close();
    }

    private void buttonEncryptedFiles_Click(object sender, EventArgs e)
    {
        this.Hide();
        FTK_Menu_Encrypted_Files mef = new FTK_Menu_Encrypted_Files();
        mef.ShowDialog();
        this.Close();
    }

    private void buttonRecentlyAccessedFiles_Click(object sender, EventArgs e)
    {
        this.Hide();
        FTK_Menu_Recently_Accessed_Files mraf = new FTK_Menu_Recently_Accessed_Files();
        mraf.ShowDialog();
        this.Close();
    }

    private void buttonRegistryHistory_Click(object sender, EventArgs e)
    {
        this.Hide();
        FTK_Menu_Registry_History mrh = new FTK_Menu_Registry_History();
        mrh.ShowDialog();
        this.Close();
    }

    private void buttonMainMenu_Click(object sender, EventArgs e)
    {
        this.Hide();
        Menu m = new Menu();
        m.ShowDialog();
        this.Close();
    }

    private void buttonLogOut_Click(object sender, EventArgs e)
    {
        this.Hide();
        Syscrawl_Login sl = new Syscrawl_Login();
        sl.ShowDialog();
        this.Close();
    }

    private void FTK_Menu_Browsing_History_Load(object sender, EventArgs e)
    {
        try
        {
            RegistryKey rk = Registry.CurrentUser;

            rk = rk.OpenSubKey("Software\\Microsoft\\Internet Explorer\\TypedURLs", 
    false);
            PrintKeys(rk);
            rk.Close();
        }
        catch (Exception MyError)
        {
            richTextBoxBrowsing.Text="An error has occurred: " + MyError.Message;
        }
    }

    void PrintKeys(RegistryKey rk)
    {
        if (rk == null)
        {
            richTextBoxBrowsing.Text="Couldn't open the desired subkey.";
            return;
        }

        richTextBoxBrowsing.Text = "Subkeys of " + rk.Name;

        try
        {
            string[] valnames = rk.GetValueNames();
            int i = 0;

            foreach (string s in valnames)
            {
                string val = (string)rk.GetValue(valnames[i++]);

        richTextBoxBrowsing.Text="-----------------------------------------------";
                richTextBoxBrowsing.Text=s + " contains " + val;
            }
        }

        catch (Exception MyError)
        {
            richTextBoxBrowsing.Text = "An errors has occurred: " + MyError.Message;
        }
    }

    private void richTextBoxBrowsing_TextChanged(object sender, EventArgs e)
    {

    }
   }
 }
  • 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-18T02:22:09+00:00Added an answer on May 18, 2026 at 2:22 am

    By saying:

    richTextBoxBrowsing.Text=
    

    in each iteration of your loop, you keep on overwriting the text. So only the last call to the Text property gets printed.

    You need to set the richTextBoxBrowsing.TextMode property to multiline, and then instead call:

    richTextBoxBrowsing.AppendText(s + " contains " + val + "\n");
    

    Oh, and by the way, use: string val = rk.GetValue(s).ToString();

    so you can remove the int i = 0; declaration

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

Sidebar

Related Questions

Consider this problem: I have a program which should fetch (let's say) 100 records
I have a program which needs to behave slightly differently on Tiger than on
I have a program which deliberately performs a divide by zero (and stores the
I have a program which has some Textareas / Labels these can be anywhere
I have a program which needs installing on windows 64 boxes. Most of the
I have a program which only needs a NotifyIcon to work as intended. So
I have an AppleScript program which creates XML tags and elements within an Adobe
I have a program in which I've lost the C++ source code. Are there
I have a program in which the user adds multiple objects to a scene.
I have an MPI program which compiles and runs, but I would like to

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.