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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:46:17+00:00 2026-05-31T10:46:17+00:00

Im making a chat program that saves the messages in files like pub0.zzc, all

  • 0

Im making a chat program that saves the messages in files like pub0.zzc, all computers that are using it will be connected to the hard drive that these files are in, so its fine. The method data.Chat.Read(MessageTypes type, string Channel) infinite loops through a try catch statement till it returns the messages. I used this before and works perfectly. But, my code was hard to manage so instead of just putting text boxes into the window and using the code each time, i created a user control (MessageViewer). It works fine, once again when I run it, BUT it freezes VS whenever I try to use the designer on the window housing the control. the probelm isnt the window because when i delete the control its fine. I think the possible errors are at RefreshMessages() and the Refresher_Tick(…)

Refresher.Stop() and .Start() is also not it, worked fine before

so here is the code:

    private void Refresher_Tick(object sender, EventArgs e)
    {
        Refresher.Stop();
        int RefreshRate = 4;
        bool Live = true;
        if (RefreshRateChoice == "Manual")
        {
            Live = false;
            RefreshRate = 1;
        }
        else if (RefreshRateChoice == "4 ( Default )")
        {
            Live = true;
            RefreshRate = 4;
        }
        else
        {
            Live = true;
            RefreshRate = Convert.ToInt32(RefreshRateChoice);
        }
        if (data.Chat.Read(MessageType, ChannelChoice) != ContentPresenter.Text && Live)
        {
            RefreshMessages();
        }
        Refresher.Interval = RefreshRate;
        Refresher.Start();
    }




    public void RefreshMessages() {
            if (data.Chat.Read(MessageType, ChannelChoice) != ContentPresenter.Text)
            {
                ContentPresenter.Text = data.Chat.Read(MessageType, ChannelChoice);
            }
    }

and if you need it:

        public static string Read(MessageTypes Type, string Channel)
        {
            string Loc;
            if (Type == MessageTypes.Public && (Channel == "1" || Channel == "2"))
            {
                return "Can not view this channel, only post to it.";
            }
            if (Type == MessageTypes.Public)
            {
                Loc = data.AssetsFolder + "\\pub" + Channel + ".zzc";
            }
            else if (Type == MessageTypes.Private)
            {
                Loc = data.AssetsFolder + "\\" + Channel + ".zzpc";
            }
            else if (Type == MessageTypes.Game)
            {
                Loc = data.AssetsFolder;
            }
            else
            {
                Loc = data.AssetsFolder;
            }
            while (true)
            {
                try
                {
                    String MessageList = "";
                    StreamReader MessageReader = new StreamReader(Loc);
                    string EncMessages = MessageReader.ReadToEnd();
                    MessageReader.Dispose();
                    List<string> EncMsgList = EncMessages.Split(';').ToList();
                    for (int i = 1; i < EncMsgList.Count; i++)
                    {
                        MessageList += data.Encodings.Decrypt(EncMsgList[i], Palettes.Message) + "\n";
                    }
                    return MessageList;
                }
                catch
                {
                    // Do nothing
                }
            }
        }
  • 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-31T10:46:19+00:00Added an answer on May 31, 2026 at 10:46 am

    You say that it “freezes.”

    In your Read method you have a while(true) loop with an embedded try…catch block, but the catch never returns you from that method. If you keep throwing the same exception, you’ll continue to loop over and over which could be where you are freezing.

    At least to prove that is the case, put a return in you catch or some diagnostic code to indicate if that is the case.

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

Sidebar

Related Questions

I am making an application that will work much like a real time chat.
I'm making a simple cross platform chat program. I'm using wXWidgets for the GUI
I'm making a chat program, and I need a place to store messages. The
I'm making a server with Java that will provide chat services for flash clients.
I'm making a chat application that works with long-polling to emulate a push from
I'm making a simple chat program for me and my friends as a tech
I am making my first Android program. I am making a local chat program.
I am making a chat window, i just want that message and date time
I am making a network application that has a chat function. On the chat
I'm making a chat script using jQuery and JSON, but my hosting suspends it

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.