Tuesday, December 1, 2009

parameterizedthreadstart

So I finished the letter generator, which works fairly well, now it time to get back to the main program. I added a logging feature about a month ago so I started looking through that, in it I saw two problems. The first was a the screen resolution on one of the station was "changing" when the monitors went to sleep I will post about that later. The other problem was I had a function that has one overload. I was trying to launch that in its own thread when I went back I saw in the logs this error:

InvaildOperationException: This thread was created using a ThreadStart delegate instead of a ParameterizedThreadStart delegate

I did a little googling and found a page on MSDN that said all I had to do was use the addressof function and it would firgure everything out for me. Since thats what I was doing I started looking other places.

The only think I found was the ParameterizedThreadStart object on MSDN again. So I started looking at the C# code did a little thinking and boom ....

Dim TempThread as new threading.thread(new threading.parameterizedthreadstart(addressof DoWork))
TempThread.start("11")


That worked great

No comments: