okposi

okposi

  • NA
  • 2
  • 0

problem creating object of main class

Feb 23 2004 12:48 AM
This problem might look stupid but I have issues with it. I created an aplication in C# //main class Public class Form1 {. . . //display in List box public void showResult(string result) { . mylisbox.add(result) } } I created another class public class GirGen { Form1 theform=new Form1(); theform.showResult("test") } The program will be hanging indefinitely. I am not sure why this happens. But if I create a new class with a display box, it works.Whay can't I create an object of the main class in C#(i.e. the one that contains the "static void Main") I want to put my display box in the main class. I also tried inheriting the main class ie public class DirGen: Form1 { . . mylistbox.add("test") } The program was hanging indefinitely too.Will apreciate your help. I need my lisb box to be in the main class. Thanks OJ