C# WPF- Changing label content automatically RRS feed

  • Question

  • Hello,

    Thanks for everything i fixed it <3

    • Edited by hccezveci Saturday, December 28, 2019 11:28 PM fixed
    • Moved by Alex-KSGZ Friday, January 3, 2020 7:43 AM
    Saturday, December 28, 2019 5:14 PM

All replies

  • You can probably use the DispatcherTimer Class. I think the sample code shows everything. It has BeginInvoke or the equivalent in it. Do not use Thread.Sleep.

    Sam Hobbs

    Saturday, December 28, 2019 8:12 PM
  • The part related to sentences can be done in this manner:

       string[] sentences = new[] { "Hello", "My name is", "Max" };

       label1.Content = sentences[i % sentences.Length];


    • Edited by Viorel_MVP Saturday, December 28, 2019 10:50 PM
    Saturday, December 28, 2019 10:47 PM
  • Note that it is much preferred for you to leave the question as it was so that others in the future can benefit from the help provided. The way that you are supposed to say that the problem is solved is to mark one or more replies as answer(s). That helps others in the future so they know what works. It also rewards us for trying to help. If you want help in the future then you should do things (leaving the question and marking helpful replies as answers) that way otherwise there is less incentive to help you.

    Sam Hobbs

    Sunday, December 29, 2019 12:00 AM