Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in code - with Stored Proc
Message
De
28/07/2004 00:18:05
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00928301
Message ID:
00928577
Vues:
29
Shawn,

You have a coupla options here, but probably the easist is to create a Constructor for CompanyRules that accepts a parameter of type Company and pass a reference to the calling Company object. Something like this:
public class CompanyRules 

  private Company oCompany;

  public CompanyRules(Company o)
  {
    this.oCompany = o;
  }
 
  // then, when you need to call the method
  this.oCompany.getDataSet();
}
The Company class would instantiate the CompanyRules class like this:
  private CompanyRules oRules = new CompanyRules(this);
There are other options, like using Interfaces, but try this first and see if you can get it working.

~~Bonnie



>This is what is happening I think.
>The form instantiates
>In the form load it calls New Company()
>In Company it creates CompanyRules()
>In CompanyRules() I want to access a getDataSet method in Company, so I thought I would create a New Company() Object
>
>I think this is the problem with the recursion you are mentioning.
>
>Stack Overflow is Happening in Main. I load the form and it all crashes with stack overflow.
>Working on that now.
>
>Thanks for the pointers and where to look.
>
>New Languages...this is why i have no hair left!!! :-)
>
>
>-->Shawn
>
>
>
>>>Thanks Bonnie, I did add the new Company to it and now i get a stack overflow error.
>>>the whole prgram crashes out.
>>>
>>>Is it a problem that company is created on the main form. and then i try to create it again?
>>
>>Shawn,
>>
>>Where are you getting the stack overflow error? Normally creating multiple instances of something will not cause this sort of problem, but then again I have no idea what your class might be doing. There might be some repetitive recursion or something going on. Have you traced it?
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform