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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:40:30+00:00 2026-05-30T01:40:30+00:00

I was wondering if someone could help me with a little issue I’m having.

  • 0

I was wondering if someone could help me with a little issue I’m having. I’m trying to update a textbox from another class but the text is not showing up on in the textbox even though it is being sent as I have printed it to the screen.

The code I’m using is below:

Program.cs

namespace Search
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]

        static void Main()
        {
            Application.EnableVisualStyles();

            try
            {
                Application.SetCompatibleTextRenderingDefault(false);
            }
            catch (InvalidOperationException e)
            {

            }
            Application.Run(new Form1());
        }

        public static readonly Form1 MainLogWindow = new Form1();
    }
}

HexToASCII:

public class HexToASCII
{
    Output o = new Output();

    public void hexToAscii(String hex, int textBox)
    {
        //Convert the string of HEX to ASCII
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < hex.Length; i += 2)
        {
            string hs = hex.Substring(i, 2);
            sb.Append(Convert.ToChar(Convert.ToUInt32(hs, 16)));
        }
        //Pass the string to be output
        string convertedHex = sb.ToString();

        Program.MainLogWindow.UpdateTextBox(convertedHex);    
    }
}

Form1:

    private delegate void NameCallBack(string varText);
    public void UpdateTextBox(string input)
    {  
        if (InvokeRequired)
        {
            textBox2.BeginInvoke(new NameCallBack(UpdateTextBox), new object[] { input });
        }
        else
        {
            textBox2.Text = textBox2.Text + Environment.NewLine + input; 
        }
    }

I have tried to run it using a new thread ThreadStart ts = delegate()… but I’m unable to get the textbox to update. Sorry I’m very new to c#, could someone please explain the issue so I can understand it and learn for next time. Many thanks 🙂

  • 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-30T01:40:32+00:00Added an answer on May 30, 2026 at 1:40 am

    This is the problem:

    static void Main()
    {
        ...
        Application.Run(new Form1());
    }
    
    public static readonly Form1 MainLogWindow = new Form1();
    

    You’re creating two forms: one of them is being shown (with Application.Run) but you’re changing the contents of the text box on the other one:

    Program.MainLogWindow.UpdateTextBox(convertedHex);  
    

    You haven’t shown how you’re calling hexToAscii in the first place – personally I would try to avoid having static references to GUI elements like this, but you could get your code to work just by changing your Main method to use:

    Application.Run(MainLogWindow);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im wondering if someone could help me out with a little issue im having.
Hey guys I was wondering if someone could provide a little help. I've been
Just wondering if someone could help me with the following issue. On my local
Hi I was wondering if someone could help me out. Ive tried Global but
I was wondering if someone could help me. Im trying to integrate some code
wondering if someone could help me, but at the same time hopefully I can
I was wondering if someone could help me. I've been having trouble understanding what
Was wondering if someone could help me out a little with this query: SELECT
I was wondering if someone could help me with a small problem I'm having.
I'm wondering if someone could help me with a Jquery css question. <div class='post'>

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.