Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 11:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[c#] Frage zu Thread's / Threading

Discussion on [c#] Frage zu Thread's / Threading within the .NET Languages forum part of the Coders Den category.

Closed Thread
 
Old 07/17/2013, 13:27   #31
 
.Stefan's Avatar
 
elite*gold: 12
Join Date: Jun 2009
Posts: 2,621
Received Thanks: 1,239
Quote:
Originally Posted by 'Aleo View Post
Code:
void ChangeText(Label Control, string text)
        {
            Control.Text = text;
        }
Wäre eine Möglichkeit in C#.
Quote:
Originally Posted by Shawak View Post
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace ui_threading
{

    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                 this.Invoke(() =>
                 {
                        Label1.Text = "Text1";
                        Thread.Sleep(5000);
                        Label1.Text = "Text2";
                 });
            });
        }
    }
}
Sollte funktionieren

Ansonsten;
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace ui_threading
{

    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                 this.Invoke(() {  Label1.Text = "Text1"; });
                 Thread.Sleep(5000);
                 this.Invoke(() {  Label1.Text = "Text2"; });
            });
        }
    }
}
Lg
Danke allen, die mir geholen haben. Das war genau das, was ich gesucht habe. Aleo hat mir die 2. Frage sehr gut beantwortet und Shawak die 1. Frage. Danke
.Stefan is offline  
Closed Thread


Similar Threads Similar Threads
C++ Threading
03/01/2013 - C/C++ - 3 Replies
Ich habe da mal eine frage zu Threading in C++ Wie kann ich eine Thread Array starten? ich weiß das ich in C# es z.B. so machen kann:) Thread myThread; myThread= new myThread;
Threading
02/22/2013 - Nostale - 3 Replies
Hi!I have a question for what i need multithreading i developing game server.Soo i know that i need this for connection.
C# Cross Threading
10/13/2012 - .NET Languages - 5 Replies
I was working on Console Applications for a long time and i was able to edit the console from almost everywhere in the project; However, when i migrated to windows forms applications i wondered that i can't edit for example a textBox from any other class because it tells me some error about cross threading So can any one help me ?
C++ Threading
03/24/2012 - CO2 Programming - 13 Replies
Anybody got some good threading tutorials in c++? #Edit Using boost would be fine?
Threading
11/18/2011 - CO2 Private Server - 10 Replies
What should I do? A thread for every map that's used by players, a global thread for all players or a single thread for every player.



All times are GMT +1. The time now is 11:18.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.