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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:06:30+00:00 2026-05-23T09:06:30+00:00

I have two words: Source: John ConvertTo: Jack and I want to show the

  • 0

I have two words:
Source: John
ConvertTo: Jack

and I want to show the effect of convert all letters from “Source” at the same time to the “ConvertTo” word. I already create a program to accomplish that but processing one letter at a time, to show the effect I use Threads, the thing is that to process all letters at the same time I suppose I need one thread per letter, and every thread will call the same function that process the letter, and I use global variables.

Here is the code (works only for texts with same lenght):

private void button1_Click(object sender, EventArgs e)
    {            
        lblResult.Text = "";
        lblResult2.Text = "";            
        ThreadPool.QueueUserWorkItem(new WaitCallback(Process));            
    }

    int movement = 0;
    string CumulateText;
    private void Process(object stateinfo)
    {
        int value;
        int operation; //0->[+] 1->[-]
        CumulateText = "";
        for (int i = 0; i <= textBox1.Text.Length - 1; i++)
        {
            if (textBox1.Text[i] != ' ')                
            {
                value = (char)textBox1.Text[i] - (char)textBox2.Text[i];
                if (value >= 0)
                    operation = 1;
                else
                    operation = 0;

                for (int ii = 0; ii <= Math.Abs(value); ii++)
                {
                    if (operation == 1)
                        movement = (char)textBox1.Text[i] - ii;
                    else
                        movement = (char)textBox1.Text[i] + ii;

                    this.Invoke(new EventHandler(ShowMovement));
                    System.Threading.Thread.Sleep(10);
                }
            }
            CumulateText += textBox2.Text[i].ToString();                
        }
    }

    private void ShowMovement(object sender, EventArgs e)
    {            
        lblResult.Text = CumulateText + Convert.ToString((char)movement);            
    }

I hope I made myself understood.
please any advise to accomplish that.
thanks

To clarify more what I want to accomplish here is an example:
Source: John
ConvertTo: Jack

J – same J
o – decrease till a (o, n, m, …, a)
h – decrease till c (h, g, f, …, c)
n – decrease till k (n, m, l, k)

  • 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-23T09:06:30+00:00Added an answer on May 23, 2026 at 9:06 am

    I once had to do something similar for a small little project I was working on for fun.

    I do not see why you would need to create a thread for each letter to create a transition between two words unless I’m not understanding what you are pretending to do correctly.

    Check and study the following code, see if its any help:

    static class Program
    {
        static void Main()
        {
            TextTranstition transition = new TextTranstition();
            transition.TransitionFinished += TransitionTicked;
            transition.TransitionTicked += TransitionTicked;
            transition.StartTransition("AmazingWordTransition", "MyNewWordAppearing", 100);
            Thread.CurrentThread.Join();
            Console.ReadKey();
        }
    
        public static void TransitionTicked(object sender, TranstitionEventArgs e)
        {
            Console.Clear();
            Console.Write(e.TransitionText);
        }
    }
    
    public class TranstitionEventArgs : EventArgs
    {
        private readonly string transitionText;
        public string TransitionText { get { return this.transitionText; } }
    
        public TranstitionEventArgs(string transitionText)
        {
            this.transitionText = transitionText;
        }
    }
    
    
    public class TextTranstition
    {
        private struct StartInfo
        {
            public StartInfo(string initialText, string finalText, int timeStep)
            {
                this.initialText = initialText;
                this.finalText = finalText;
                this.timeStep = timeStep;
            }
    
            private readonly string initialText;
            public string InitialText { get { return this.initialText; } }
    
            private readonly string finalText;
            public string FinalText { get { return this.finalText; } }
    
            private readonly int timeStep;
            public int TimeStep { get { return this.timeStep; } }
        }
    
        public EventHandler<TranstitionEventArgs> TransitionFinished;
        public EventHandler<TranstitionEventArgs> TransitionTicked;
    
        public void StartTransition(string initialText, string finalText, int timeStep)
        {
            StartInfo startInfo = new StartInfo(initialText, finalText, timeStep);
            Thread t = new Thread(startTransition);
            t.Start(startInfo);
        }
    
        private void startTransition(object info)
        {
            StartInfo startInfo = (StartInfo)info;
            string initialText = startInfo.InitialText;
            string finalText = startInfo.FinalText;
    
            if (initialText.Length < finalText.Length)
            {
                initialText = initialText.PadRight(finalText.Length);
            }
    
            if (TransitionTicked != null) TransitionTicked(this, new TranstitionEventArgs(initialText));
    
            while ((initialText = transition(initialText, finalText)) != finalText)
            {
                Thread.Sleep(startInfo.TimeStep);
                if (TransitionTicked != null) TransitionTicked(this, new TranstitionEventArgs(initialText));
            }
    
            if (TransitionFinished != null) TransitionFinished(this, new TranstitionEventArgs(finalText));
        }
    
        private string transition(string initialText, string finalText)
        {
            StringBuilder b = new StringBuilder(finalText.Length);
    
            for (int i = 0; i < finalText.Length; i++)
            {
                char c = initialText[i];
                int charCode = (int)c;
    
                if (c != finalText[i])
                {
                    if (charCode == 122 || charCode==32) charCode = 65;
                    else if (charCode == 90) charCode = 97;
                    else
                    {
                        charCode += 1;
                    }
                }
    
                b.Append((char)charCode);
            }
    
            return b.ToString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I check if two words have a common char? ex. : word
I have two files which both contain a list of words. Is there an
I have two tables. One table contains words. Other table contains points. table words:
I have been coming across these two words more often but i didn't see
I have two NSMutabeArrays, one full of numbers, the other full of words. Lets
Good Day, I have a simple working routine in Perl that swaps two words:
I am trying to get at least three words separated by two commas.I have
I have a form where I can input two words then compare the levenshtein
Basically, I have two tables (Article and Tag) and I want to make many-to-many
Assume I have a string text = A compiler translates code from a source

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.