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

C#

 
GeneralRe: WebBrowser control displaying security alert dialogs Pin
GriffonRL20-Feb-03 5:57
GriffonRL20-Feb-03 5:57 
GeneralRe: WebBrowser control displaying security alert dialogs Pin
Stephane Rodriguez.20-Feb-03 6:35
Stephane Rodriguez.20-Feb-03 6:35 
GeneralLogin & Application Form Pin
vladmihai20-Feb-03 5:16
vladmihai20-Feb-03 5:16 
GeneralRe: Login & Application Form Pin
Nnamdi Onyeyiri20-Feb-03 5:34
Nnamdi Onyeyiri20-Feb-03 5:34 
GeneralRe: Login & Application Form Pin
Chris Austin20-Feb-03 5:35
Chris Austin20-Feb-03 5:35 
GeneralRe: Login & Application Form Pin
vladmihai20-Feb-03 8:49
vladmihai20-Feb-03 8:49 
GeneralRe: Login & Application Form Pin
Chris Austin20-Feb-03 9:16
Chris Austin20-Feb-03 9:16 
GeneralThe chicken-and-egg problem. OO HELP!! Pin
~toki20-Feb-03 4:01
~toki20-Feb-03 4:01 
I have a main form with a main process that evaluate ever the same proc "MyMethod", ok, but.. this method are store in another class. (ok too)

The Problem.. This "another" class are ever a UserControl,, but i make several copies of thies UserControl and change some layout properties on each one (screen1, screen2)

The unique difference between these screenX are the graphic layout. (This are what i need the graphical properties values)


But,,, How can i do to "switch" the call to MyMethod in order to the "current" screenX object.
The "current" screen is variable.

Of course screen(x) can be 100. I need to do it in a dinamic way.

Here are an aproach to the problem (i wrote this code without test it..)
Note the ????
-------------------------------------------------------------------------------------
using System;<br />
using System.Windows.Forms;<br />
namespace myApp<br />
{<br />
	// activeScreen must be public (this is call by several classes)<br />
	public ???? activeScreen <br />
<br />
	public class myApp : System.Windows.Forms.Form<br />
	{<br />
		public mYApp() {<br />
			// value=1 must be created Screen1 object<br />
			// value=2 must be created Screen2 object<br />
<br />
		<br />
			// Variable condition<br />
			int value = 1;<br />
<br />
			switch(value) {<br />
				case 1:<br />
					// How create "Screen1" and asign to activeScreen ????<br />
					// Remember activeScreen must be access by another clasess<br />
					Console.WriteLine(activeScreen.MyMethod());<br />
					break;		<br />
<br />
				case 2:<br />
					// How create "Screen2" and asign to activeScreen ????<br />
					Console.WriteLine(activeScreen.MyMethod());<br />
					break;<br />
			}		<br />
		}<br />
	}<br />
}
-------------------------------------------------------------------------------------
using System;<br />
using System.Windows.Forms;<br />
namespace myApp<br />
{<br />
	public class Screen2 : System.Windows.Forms.UserControl<br />
	{<br />
		public Screen2()<br />
		{<br />
		<br />
		}<br />
		public int MyMethod() {<br />
			int value = 2;<br />
			return value;<br />
		}<br />
	}<br />
}

-------------------------------------------------------------------------------------
using System;<br />
using System.Windows.Forms;<br />
namespace myApp<br />
{<br />
	public class Screen1 : System.Windows.Forms.UserControl<br />
	{<br />
		public Screen1()<br />
		{<br />
		<br />
		}<br />
		public int MyMethod() {<br />
			int value = 1;<br />
			return value;<br />
		}<br />
	}<br />
}
-------------------------------------------------------------------------------------
GeneralRe: The chicken-and-egg problem. OO HELP!! Pin
Nnamdi Onyeyiri20-Feb-03 5:44
Nnamdi Onyeyiri20-Feb-03 5:44 
QuestionHow to know which version of Microsoft Office are installed Pin
Hawkmoon19-Feb-03 23:34
Hawkmoon19-Feb-03 23:34 
AnswerRe: How to know which version of Microsoft Office are installed Pin
Stephane Rodriguez.20-Feb-03 5:39
Stephane Rodriguez.20-Feb-03 5:39 
GeneralRe: How to know which version of Microsoft Office are installed Pin
Hawkmoon20-Feb-03 23:25
Hawkmoon20-Feb-03 23:25 
QuestionHow to display a window form inside another form Pin
faad19-Feb-03 19:57
faad19-Feb-03 19:57 
AnswerRe: How to display a window form inside another form Pin
Chris Austin20-Feb-03 3:45
Chris Austin20-Feb-03 3:45 
GeneralRe: How to display a window form inside another form Pin
faad20-Feb-03 17:42
faad20-Feb-03 17:42 
GeneralRe: How to display a window form inside another form Pin
Chris Austin20-Feb-03 18:32
Chris Austin20-Feb-03 18:32 
GeneralThis is a dump question. Pin
Braincrash19-Feb-03 14:25
Braincrash19-Feb-03 14:25 
GeneralRe: This is a dump question. Pin
jtmtv1819-Feb-03 19:31
jtmtv1819-Feb-03 19:31 
GeneralRe: This is a dump question. Pin
Braincrash20-Feb-03 13:33
Braincrash20-Feb-03 13:33 
GeneralDesigner doesn't delete code Pin
crosenbury19-Feb-03 10:53
crosenbury19-Feb-03 10:53 
QuestionMove a Webbrowser to a new window? Pin
Bog19-Feb-03 7:53
Bog19-Feb-03 7:53 
AnswerRe: Move a Webbrowser to a new window? Pin
Stephane Rodriguez.19-Feb-03 11:07
Stephane Rodriguez.19-Feb-03 11:07 
GeneralRe: Move a Webbrowser to a new window? Pin
Bog20-Feb-03 6:55
Bog20-Feb-03 6:55 
GeneralSearching a C# String Pin
vlusardi19-Feb-03 7:29
vlusardi19-Feb-03 7:29 
GeneralRe: Searching a C# String Pin
Chris Austin19-Feb-03 8:19
Chris Austin19-Feb-03 8:19 

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.