I am currently trying out a code to generate image from html pages and i was trying with the code from bitmap webbrowser.

some how i just keep on getting error when the following method run for second times (i guess the threading is the main issue). i am using .net 3.5 by the way.
`

public Bitmap GenerateThumbnail()
    {
        Thread thread = new Thread(new ThreadStart(GenerateThumbnailInteral));
        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();
        thread.Join();
        return ThumbnailImage;
    }

Edit : not looped
I just keep on create the thumbnail instant ... For every HTML pages, the code will call a new thumbnail...

Recommended Answers

All 3 Replies

Can you post the exact error you are receiving

Error : Expected ')'
Code : 0

i know this sound stupid, but the the code run once and i can't find a mistake on the code.
What i have changed is create another if...else case to read second / third / ...so on input.

if i just choose 1 website, it can display the image with no problem. but it will encounter error when i choose to display 2 or more.

            string url = "";
            Thumbnail thumbnail = new Thumbnail(url, 800, 600, width, height);
            Bitmap image = thumbnail.GenerateThumbnail(url);
            image.Save(Server.MapPath("~") + "/Thumbnail.bmp");
            list.Add("~/Thumbnail.bmp");

for your information, this is the if...else

i put 8 if...else case, and they are all the same by the way.
i tested the thread.isAlive at the thread section and it did close as expected and "desired" (during the first time creation).

thanks for reply T______T

found out the where the error is... really lack a ) ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.