0

Well I have this code to change the UI Elements in C#, that I found here in StackOverflow, but I couldn't find one equivalent in C++, cause I want to change it in BackgroundWorker

label4.Invoke(new Action(() =>
{
  label4.Text = "Hello";
}
));

this up here is a c# working example.

I tried something by using this example to make one example to add items into a CheckList Box, This is what I have, but it doesn't work in C++, I'm obviously using the wrong way to change it.

clb_contas->Invoke(new Action(() => {
                clb_contas->Items->Add(System::String("testeCheckBox"),item), CheckState::Checked); 
            }
            ));

What would I have to change in this code up here to make it work in C++ ?

Thanks in advance.

Grego
  • 2,178
  • 9
  • 39
  • 61
  • You keep stumbling on basic language syntax. When are you going to get a book a learn it? Why are you writing UI code in C++/CLI anyway? – Hans Passant May 11 '12 at 00:58
  • I'm using a book to learn it, but the problem is that it doesn't have everything, some specific things we can find only in internet with the users' experience and most of all examples are for C# and not for C++, and the project was asked to do in C++, so I don't have a choice. :/ if it is basic language syntax, would you mind answering it? Thanks! – Grego May 11 '12 at 15:21
  • Possible duplicate: http://stackoverflow.com/questions/3247429/how-do-i-use-methodinvoker-in-c/3247921#3247921 – Hans Passant May 11 '12 at 16:24

0 Answers0