Newbie Show report error

Hello

Forgive me as i am very new to these reports.

I have attached the error i get when i try render my report this is my code.
wrote:
List<test> t = new List<test>();
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
t.Add(new test());
WebReport1.Report.RegisterData(t, "Statment");
WebReport1.Report.Show();

public class test
{
public test()
{
DocNo = "test";
Type = "test";
Date = "test";
Description = "test";
Amount = "test";
Balance = "test";
Age = "test";
}
public string DocNo { get; set; }
public string Type { get; set; }
public string Date { get; set; }
public string Description { get; set; }
public string Amount { get; set; }
public string Balance { get; set; }
public string Age { get; set; }
}

The error i get is

Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.

Any suggestions

Comments

  • edited 12:33PM
    Hello,

    remove this line of code:
    WebReport1.Report.Show();
    it's for Windows.Forms only.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.