Click here to Skip to main content
15,887,968 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to convert html file to doc or rtf format Pin
Heath Stewart9-Mar-04 8:47
protectorHeath Stewart9-Mar-04 8:47 
GeneralEditing Images on the fly... Pin
Verdant1239-Mar-04 7:08
Verdant1239-Mar-04 7:08 
GeneralRe: Editing Images on the fly... Pin
Heath Stewart9-Mar-04 8:34
protectorHeath Stewart9-Mar-04 8:34 
QuestionHow to convert html file to pdf Pin
Inam9-Mar-04 7:07
Inam9-Mar-04 7:07 
AnswerRe: How to convert html file to pdf Pin
Heath Stewart9-Mar-04 8:40
protectorHeath Stewart9-Mar-04 8:40 
GeneralMultiple Classes and Functions/Methods Pin
thewebmonster9-Mar-04 6:47
thewebmonster9-Mar-04 6:47 
GeneralRe: Multiple Classes and Functions/Methods Pin
LongRange.Shooter9-Mar-04 6:57
LongRange.Shooter9-Mar-04 6:57 
GeneralRe: Multiple Classes and Functions/Methods Pin
Heath Stewart9-Mar-04 7:02
protectorHeath Stewart9-Mar-04 7:02 
Your database class needs to be able to access an instance of your form if you need to call an instance method (to make the method static would also be problematic since you can only add data to your UI in an instance of the form). If your form, for example, is what creates the instance of your database class, pass this (a self-reference to the form) to the database class's constructor or something. Another way - although not recommended - is to provide a static property on your form class that gets an instance of the form, which the form can set in its constructor like so:
public class MyForm : Form
{
  public MyForm()
  {
    instance = this;
  }
  private static MyForm instance;
  public static MyForm Instance { get { return instance; } }
}
The problem with this is that multiple instance of your form will "reset" the static field (and be returned in the property). If you're sure that you'll never have more than one instance of this form, this would work in a pinch, though something like the first way I mentioned (passing an instance of the form to your database class) might be better if possible.

 

Microsoft MVP, Visual C#
My Articles
Generalserializing a delegate to a non-public method Pin
Judah Gabriel Himango9-Mar-04 6:11
sponsorJudah Gabriel Himango9-Mar-04 6:11 
GeneralRe: serializing a delegate to a non-public method Pin
LongRange.Shooter9-Mar-04 6:35
LongRange.Shooter9-Mar-04 6:35 
GeneralRe: serializing a delegate to a non-public method Pin
Judah Gabriel Himango9-Mar-04 9:17
sponsorJudah Gabriel Himango9-Mar-04 9:17 
GeneralRe: serializing a delegate to a non-public method Pin
LongRange.Shooter9-Mar-04 9:50
LongRange.Shooter9-Mar-04 9:50 
GeneralRe: serializing a delegate to a non-public method Pin
LongRange.Shooter9-Mar-04 6:40
LongRange.Shooter9-Mar-04 6:40 
GeneralBrush that does not mix with the background color Pin
Manobal9-Mar-04 6:08
Manobal9-Mar-04 6:08 
GeneralRe: Brush that does not mix with the background color Pin
Heath Stewart9-Mar-04 6:25
protectorHeath Stewart9-Mar-04 6:25 
GeneralRe: Brush that does not mix with the background color Pin
Manobal9-Mar-04 6:33
Manobal9-Mar-04 6:33 
QuestionChanging permission on a folder from C#? Pin
Xiangyang Liu 刘向阳9-Mar-04 2:45
Xiangyang Liu 刘向阳9-Mar-04 2:45 
AnswerRe: Changing permission on a folder from C#? Pin
Matthew Hazlett9-Mar-04 5:12
Matthew Hazlett9-Mar-04 5:12 
GeneralRe: Changing permission on a folder from C#? Pin
Xiangyang Liu 刘向阳9-Mar-04 5:27
Xiangyang Liu 刘向阳9-Mar-04 5:27 
GeneralRe: Changing permission on a folder from C#? Pin
Heath Stewart9-Mar-04 5:34
protectorHeath Stewart9-Mar-04 5:34 
AnswerRe: Changing permission on a folder from C#? Pin
Heath Stewart9-Mar-04 6:30
protectorHeath Stewart9-Mar-04 6:30 
GeneralRe: Changing permission on a folder from C#? Pin
Nick Parker9-Mar-04 6:34
protectorNick Parker9-Mar-04 6:34 
GeneralRe: Changing permission on a folder from C#? Pin
Heath Stewart9-Mar-04 6:47
protectorHeath Stewart9-Mar-04 6:47 
GeneralRe: Changing permission on a folder from C#? Pin
Nick Parker9-Mar-04 7:07
protectorNick Parker9-Mar-04 7:07 
GeneralRe: Changing permission on a folder from C#? Pin
Xiangyang Liu 刘向阳9-Mar-04 7:24
Xiangyang Liu 刘向阳9-Mar-04 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.