Click here to Skip to main content
16,008,469 members
Home / Discussions / C#
   

C#

 
GeneralRe: Serialization problem Pin
AB777131-Aug-06 0:58
AB777131-Aug-06 0:58 
GeneralRe: Serialization problem Pin
AB777131-Aug-06 1:29
AB777131-Aug-06 1:29 
GeneralRe: Serialization problem Pin
-Yoyosh-31-Aug-06 7:40
-Yoyosh-31-Aug-06 7:40 
Question.netmodule Pin
waheed awan28-Aug-06 10:03
waheed awan28-Aug-06 10:03 
AnswerRe: .netmodule Pin
Judah Gabriel Himango28-Aug-06 12:37
sponsorJudah Gabriel Himango28-Aug-06 12:37 
Questionhow to access a non-static method from another object? Pin
michal.kreslik28-Aug-06 9:44
michal.kreslik28-Aug-06 9:44 
AnswerRe: how to access a non-static method from another object? Pin
numbers1thru928-Aug-06 9:52
numbers1thru928-Aug-06 9:52 
AnswerRe: how to access a non-static method from another object? Pin
likefood28-Aug-06 10:01
likefood28-Aug-06 10:01 
I'm not sure how safe it is, but this is what I'd do:
Pass in Form1 into Form2's and Form3's constructors, like this:
class bla : Form
{
	private Form FORM1;
	[...]
	
	public bla(Form form1)
	{
		FORM1 = form1;
		[...]
	}
	
	[...]
	
	private someMethod()
	{
		FORM1.AddOne();
	}
	
	[...]
}

Since this is OOP we're talking about, you're just passing in the address of Form1 into the constructors. You just have to remember to instantiate Form1 before Form2 and Form3.

I've been known to do this, passing a form to different controls so that they can call the form's instance methods.

Like I said, I don't know how safe it is providing a form instance to the other constructors, but it should work (and I've never had any problems with that method).

Something else you could do is create a static member like this:

public static Form1 theForm;

And, when you instantiate Form1, set the static variable to the instance, like this:
Form1 f = new Form1();
thisClass.theForm = f;

Hope this helps!

-Daniel
Typing too fast fro my owngood

AnswerRe: how to access a non-static method from another object? [modified] Pin
michal.kreslik28-Aug-06 10:16
michal.kreslik28-Aug-06 10:16 
GeneralRe: how to access a non-static method from another object? Pin
Judah Gabriel Himango28-Aug-06 12:50
sponsorJudah Gabriel Himango28-Aug-06 12:50 
QuestionRegarding Final Year Project Pin
Muhammad Chitrali28-Aug-06 9:12
Muhammad Chitrali28-Aug-06 9:12 
AnswerRe: Regarding Final Year Project Pin
Eric Dahlvang28-Aug-06 11:26
Eric Dahlvang28-Aug-06 11:26 
AnswerRe: Regarding Final Year Project Pin
Professor Sharada Ulhas28-Aug-06 12:55
Professor Sharada Ulhas28-Aug-06 12:55 
GeneralRe: Regarding Final Year Project Pin
Muhammad Chitrali29-Aug-06 22:54
Muhammad Chitrali29-Aug-06 22:54 
QuestionHow to extract Image metadata Pin
pasha2k28-Aug-06 8:49
pasha2k28-Aug-06 8:49 
AnswerRe: How to extract Image metadata Pin
Eric Dahlvang28-Aug-06 11:33
Eric Dahlvang28-Aug-06 11:33 
QuestionParse a text file into an object Pin
AndyHug28-Aug-06 8:41
AndyHug28-Aug-06 8:41 
AnswerRe: Parse a text file into an object Pin
Ed.Poore28-Aug-06 9:14
Ed.Poore28-Aug-06 9:14 
AnswerRe: Parse a text file into an object Pin
Not Active28-Aug-06 9:15
mentorNot Active28-Aug-06 9:15 
AnswerRe: Parse a text file into an object Pin
SomeGuyThatIsMe28-Aug-06 9:16
SomeGuyThatIsMe28-Aug-06 9:16 
GeneralRe: Parse a text file into an object Pin
Guffa28-Aug-06 9:35
Guffa28-Aug-06 9:35 
GeneralRe: Parse a text file into an object Pin
SomeGuyThatIsMe28-Aug-06 9:42
SomeGuyThatIsMe28-Aug-06 9:42 
GeneralRe: Parse a text file into an object Pin
AndyHug28-Aug-06 9:41
AndyHug28-Aug-06 9:41 
GeneralRe: Parse a text file into an object Pin
SomeGuyThatIsMe28-Aug-06 10:09
SomeGuyThatIsMe28-Aug-06 10:09 
GeneralRe: Parse a text file into an object Pin
AndyHug30-Aug-06 4:31
AndyHug30-Aug-06 4:31 

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.