|
Make the instance of class 4 a member of class 1, with protected access, so that class 2 and 3 can access it.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Muntyness wrote: or should I just call the two instances of class 4?
Not possible to answer definitively without more context, but that is a reasonable approach. Another might be a class 1.2 that encapsulates the use of class 4 and then class 2 and 3 derive from class 1.2 rather than from class 1.
led mike
|
|
|
|
|
Can you put class outline, it will make easy to understand what exactly you want....
|
|
|
|
|
M Aamir Maniar: This will probably make you more confused, but....
Static Class 1
|
--> Class 2 + Class 3
then
Class 2 + Class 3
|
---->Class 4 method
So class 1 on creates both class 2 and 3.
Then a method in either 2 or 3 calls a method in 4.
MP (2): Its a static, so it wont let me create a protected instance of class 4.
led mike: You suggestion might work, but I'm going to try to avoid it.
(I only want class 4 as either children of 2 and 3 or a seperate instance from them, because of what it does)
Dave
|
|
|
|
|
Then go with Marilyn Manson's reply
|
|
|
|
|
If class 4 is static, then there is nothing stopping you from using that method.
Assume everything below is all in the same namespace.
public static class Calculator
{
public static int Compute(param obj[] parms){...}
}
public class One
{
Class2 clas2 = new Class2();
Class3 clas3 = new Class3();
....
clas2.Consume();
clas3.Consume();
}
public class Class2
{
public void COnsume()
{
Calculator.Compute(parms);
}
}
public class Class3
{
public void Consume()
{
Calculator.Compute(otherParms);
}
}
|
|
|
|
|
Hi,
How to get the height and width of a window which has a scrollbar both horizontal and vertical.
Thanks
Subramanya
|
|
|
|
|
Subramanyahs wrote: How to get the height and width of a window which has a scrollbar both horizontal and vertical.
The height and width should be the same regardless of what is inside the window. However if you are trying figure the height and width of the inner area just subtract the width of the scrollbars from the window's width and height.
=====Brain melting code=====
static int Sqrt(int x){ if (x<0) throw new ArgumentOutOfRangeException(); int temp, y=0, b=0x8000, bshft=15, v=x; do { if (v>=(temp=(y<<1)+b<<bshft--)) { y+=b; v-=temp; } } while ((b>>=1)>0); return y; :omg:
====TSI TLFL EEOOLHTG=====
^^^^^^^^^^^^^^^^^
Decode that and you will win.;P
============Hint===========
cout << "33 20 57 4F 52 44 53 62 63 6B 77 6F 72 64 73";
|
|
|
|
|
I am new to C# & .Net.
I have an application that have some .exe files. It used to execute with the help of some Dll's. .exe files used to execute only if these dlls and exe files are in the same folder.
The problem is that when i am trying to create a window installer for my application, it used to create all dlls and exe files in program(start) menu. whereas i just wants to have the exe in the program menu, not the dll's. For e.g if we use the setup of winamp or any other application, on clicking the setup, it installs and only exe will be there in the program menu. No supporting files will be there.
hope it may give you an idea of what am i trying to ask....
thanks in advance
Praveen Raghuvanshi
Software Engineer,
Wins Infotek Pvt. LTd.
Technopark, Trivandrum
India.
|
|
|
|
|
Have you looked at Advanced Installer[^]? The basic version also happens to be free and works fine for me.
ChrisB
|
|
|
|
|
thanks chris for the reply.
advanced installer is a paid tool.
can't we do the things using windows installer.
if yes, please tell the procedure.
|
|
|
|
|
The free version of advanced installer works fine for me, but have you looked at the "setup" project type in visual studio?
You need to add a setup project to your solution.
Then you tell it where to install the files (exe, dll) to, then you create "shortcuts" to the exe file(s) in the "start-menu" part.
When you run the setup, it places the files in the folder, and the shortcuts to the files in the start menu.
As I remember it's not too easy to use, but using drag & drop and right click you should be able to use it of.
VS2005 has a "Setup Wizard Progect" to help you. - File > New Project > Other Project Types > Setup & Deployment.
ChrisB
|
|
|
|
|
Thanks again. your reply gave me a way to start.
1 more problem is there. Inside the Desktop and Program menu folder, i have created 2 shortcut for 2 diff exe's. Those 2 exe's have 2 different icons, but with same name. So, when i used to install the setup.exe. it used to create shortcut for the 2 exe's with their icons. In addition to that 1 more icon used to get added in the program menu.
In total there are 4 files in my desktop folder.
2 are exe's and 2 are icon files.
Thanks in advance.
|
|
|
|
|
Could you not set the exe icon property (in the application settings - not part of the setup) to use the specific icon? Then you would not need to include the icon file as part of your setup.
Just a thought.
ChrisB
|
|
|
|
|
Now all the things are working proper.
thanks a lot.
|
|
|
|
|
Hello everybody.
I have a problem.I'm working with VS2005 and my project is a C# windows application. I define an array of buttons but I don't know how to make EventHandler for this array;
Thanks for all.
t_nedelchev
|
|
|
|
|
for (i=0; i < ...) {
btnArr[i].Click += new System.EventHandler(NameOfYourClickHandler);
btnArr[i].Tag = i;
}
Then declare a function called NameOfYourClickHandler:
public void NameOfYourClickHandler(object sender, System.EventArgs e) {
MessageBox.Show(((System.Windows.Button)sender).Tag.ToString());
}
Ut
|
|
|
|
|
Hi all,
Is there a way to say Process.Start("THEFile") and say with what program to open it in?
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Process oProcess = new Process();
oProcess.StartInfo.Arguments = "D:\\Temp\\MyFile.txt";
oProcess.StartInfo.FileName = "notepad.exe";
oProcess.Start();
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi, Thank you... I will try your way in a moment.
I have come across this... Process.Start("excel.exe", Convert.ToString(Path) + "\\" + Convert.ToString(FileName) + ".xml")
I get an error saying 'c:\program.xls' not found....
BUT the file i want to open is a xml file....
i think it reads the path up to the first space and then continues...
The Variables Values are:
Path = @"c:\Program files\Reports"
FileName = "CL"
Please help
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
char cQuote = Convert.ToChar(34);
Process.Start("excel.exe", cQuote + Path + "\\" + FileName + ".xml" + cQuote);
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thank you Eric
That was exactly what i was looking for...
It works just like i imagined it. Thanks.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
I've created Resource.resx, which has some images. The resources are named as Res1, Res2, Res3 etc.
I'm dynamically creating some PictureBoxes, using this function:
public PictureBox AddNewPicBox(int n)
{
Create a new instance of the PictureBox class.
PictureBox picBoxLine = new PictureBox();
this.Controls.Add(picBoxLine);
picBoxLine.Width = 25;
picBoxLine.Left = (n-1) * 25;
picBoxLine.Top = 1;
picBoxLine.Tag = n;
}
In this function, I want to set the Image property of the newly created PictureBox depending on parameter n.
For eg. if n = 1, I want
picBoxLine.Image = ResourcesImages.Res1;
When n=2,
I want
picBoxLine.Image = ResourcesImages.Res2;
Any idea how to do this?
Ut
|
|
|
|
|
ResourceManager res = new ResourceManager("MyResourceProject.Properties.Resources", Assembly.GetExecutingAssembly());
picBoxLine.Image = (System.Drawing.Image) res.GetObject("Res" + n.ToString());
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
That worked. Thanks a lot!
Ut
|
|
|
|