|
The reason that many options exist is that different ones are better suited to different situations. Use the most lightweight object that lets you achieve your goal.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello All,
I have a desktop application which have the a MDI from and some childs forms.
when i cleck on MDI's menu one form is open like
Form1 frm=new Form1();
frm.show();
this is OK. But whenever user again click onto the menu again a form is displayed
I know this is because of
Form1 frm=new Form1();
But i want to show form only once i.e. If form open then no need to show it else show...
how I can do this..?
Regards
Pankaj Joshi
|
|
|
|
|
Hi,
there are many ways to do this, e.g. keeping a counter (or boolean flag).
The preferred one however is by simply disabling the menu item so the user sees he will
not be able to do it again.
|
|
|
|
|
Thx For Your Reply ,
I tried what you said ... but unable to got success because of the following regions.
1. Public Variables are not allowed in C#.
2. Every thing is object oriented that means you have to decalare a new instance of class variable before use it.
Say I have one MDI and two childs forms when I click on the menu and form1 is shows I use a class say class1
which public variable i assign as true say
public bool isForm1Shows=false;
When I use this in MDI I have to make a object of class1 to use isForm1Shows when I done this
isForm1Shows automatically goes false and creates problem. say after displaying the form1 i assign
this like
form1 frm= new form1();
isForm1Shows=true;
frm.show;
Then its ok but when i close the form1 what happned..? i have to write code on disposing method of the
form1 and again if i want to use Class1 here I have to create an object by keyword NEW then
isForm1Shows automatically goes to false. and this creates problem to me.
I think You got what i want to say
please Help me....
Regards
Pankaj Joshi
|
|
|
|
|
Hi,
your isForm1Shows should not be an instance (=non-static) member of Form1.
Make it either:
- an instance member of the class that creates the forms (your app itself?);
- a static member of the Form1 class (so it is shared by all Form1 instances,
and can be accessed even before the first Form1 instance exists).
You set it to true when you dco the frm.Show(); that is OK. Now you must set
it to false again when the form gets closed; this requires using one of
the events, e.g. the Closed event.
I dont see why you mention disposing the form; you can achieve what you want
without it...
If you are unfamiliar with static, public, Closed event, I strongly recommend
you buy a book on C# and work your way through it...
Good luck.
|
|
|
|
|
I assume it's not modal. In this case, it should be a member variable regardless, and you can check if it's visible before showing it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sir Sir Sir,
how i can check it is visible or not for checking visibility I have to create an
instance of that. And whenever I create New instance it create a new form
Please help
Regards
Pankaj Joshi
|
|
|
|
|
Hi, why not loop through the child forms. What i do is set the form to max, but you could check for your form.name or whatever property you would like to juse
Form[] charr= this.MdiChildren; <br />
<br />
foreach (Form chform in charr) <br />
chform.WindowState=FormWindowState.Maximized;
Kind regards,
marcel vreuls
http://www.marcelvreuls.com
|
|
|
|
|
Thx For Reply,
But i can't get this method yet..
and what about the forms which have maximize propety false please
give me a simple solution.
Regards
Pankaj Joshi
|
|
|
|
|
Is it possible to see from web whether or not the EXE is installed on a
machine? for example, i'd like to check if gtalk or realoneplayer is installed in localmachine and if it is not installed ,how can find from web.at that time i want to give alert message or give the downloaded page.Is it is possible bc..Plz any one help me.
Thanks.
Regards,
justin
|
|
|
|
|
Yes.
You might consider attempting to read the default value from the
registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App
Paths\realoneplayer.exe.
Hope this will help you.
ANd you can alert the Message using Javascript.
Regards,
Satips.
|
|
|
|
|
Thanks for ur reply..
I cant able to read the register key value from web.Bcz security exception occur.
regards,
justin
|
|
|
|
|
|
What?
Regards,
Satips.
|
|
|
|
|
How get Dll's or OCX's ProgID?
|
|
|
|
|
Hi All,
I'm relatively new to C# and have finally come unstuck - so i think anyway. My problem is i have a couple of formula's and the first part is okay but when it gets to the second part i can't seem to get an answer. Below is a sample of what i'm doing and i was just wondering if anyone could give me a point in the right direction?? I have a feeling that it is because the total of sum2 comes back as a decimal value, any way let me know what you think??
int number1; (say value is 10)
int number2; (say value is 6)
int number3; (say value is 2)
int sum; (value would be 4)
int sum2; (should return value of 50)
int iHundred = 100;
sum = number1 - number2;
sum2 = number3 / sum * iHundred;
Also i should say when i debug number3, sum and iHundred all return values and sum2 returns 0
Thanks
Aj...
|
|
|
|
|
Instead of int go for Decimal datatype.
Regards,
Satips.
|
|
|
|
|
Satips wrote: Instead of int go for Decimal datatype.
I think that you mean Double.
Decimal has higher precision, but therefore it's also slower and harder to use. For any normal calculations Double is the preferred type.
---
single minded; short sighted; long gone;
|
|
|
|
|
Also the int iHundred is pointless. Just whenever you want to use iHundred type the number 100, its the same unless you have iHundred change.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Thanks heaps Satips and ExpertComing. I wish you could have given more - but hey, then i wouldn't be learning. Once again thanks i eventually got it all worked out.
Aj...
|
|
|
|
|
Just remember variables are ment to be variables, you can make a variable a constant but you do that for things that you want to change in one place. Numbers will always be a number.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
can I use c++ classes and headers in c# programs or do I have to reimplement
them?
I am thinking of migrating to c# but I do not want to have to recode
all my existing c++/c code.
|
|
|
|
|
Unless you compile the code into a library using a C++ compiler, start rewriting!
|
|
|
|
|
That is not a silly question at all.
I see three options:
1. use an existing native code (i.e. unmanaged) dll and use P/Invoke (only useful
if you dont have the source)
2. compile C/C++ to managed code dll (requires source code)
3. rewrite to C#
If the existing code is large, good functional match and high quality I would go for 2;
otherwise I would go for 3.
-- modified at 11:31 Saturday 9th June, 2007
|
|
|
|
|
i programmed a program and i want it to be loaded autimatically when windows load. how can i do it in C# ?
|
|
|
|