|
In my application I have two forms (Form1 & Form2).Form1 having button1(btn1).
When click btn1, I show Form2 by creating by instance of Form2.
Form1 still visible now. If Once again I click btn1, I want to prevent the creation of new instance of form2.It should show already opened Form2.
How can i made this?
I am beginner in c#.Please tell me briefly.
|
|
|
|
|
There's no need to post a second thread. The first one you posted is good enough. You just didn't ask your question correctly.
<br />
class Form1 : Form<br />
{<br />
private Form2 myOtherForm = null;<br />
<br />
protected void btn1_OnClick(...)<br />
{<br />
if (this.myOtherForm == null)<br />
this.myOtherForm = new Form2();<br />
this.myOtherForm.Show();<br />
}<br />
<br />
}<br />
That should take care of it.
You could do much more complicated things involving singletons and such, but that's probably overkill.
|
|
|
|
|
Hello. I want to learn that converting an excel chart or table to pdf with iTextSharp.dll is possible or not?
If it is possible which classes I must use?
Is there any example or link that you can recommend?
If anybody help me I will be glad.
Thank you.
Murat
|
|
|
|
|
It is possible but you have to do a lot on your own.. iTextSharp can write tables by using PdfPTable . However there is no class included that reads an excel file and writes a pdf so you also have to use interop or an excel reader class to get the data from excel.... It's not difficult but it takes while I guess!
|
|
|
|
|
In my windows application (C#).
I have a mainform with toolbar control and two additional forms(says subform1,subform2)
when i click toolbarbutton1 subform1 was open.
when i click toolbarbutton2 subform2 was open.
now i have one button in subform2 which is used to rediect the user to the subform1. My requirement is ...,
Instead of create new instance of subform1,i want to use already opened subform1.
give some idea that satisfy my above requirement.
|
|
|
|
|
What does that have to do with threading?
Change the constructor of the subform2 to accept a reference to a form. When you create subform2 you pass along a reference either to the main form or subform1. Subform2 can then use that reference to set focus on subform1 either by accessing a method in the main form that does it or do it itself.
A refence to the main form would be the choise if subform1 doesn't have to be created before subform2 is.
---
b { font-weight: normal; }
|
|
|
|
|
But i dont know how make the refrence to another form.
please tell me briefly.
|
|
|
|
|
To show any form, you do something like:
<br />
MyForm myForm = new MyForm();<br />
The variable myForm is a reference. If you only have one of those, there will only be one form.
|
|
|
|
|
You probably have used it without knowing it...
The reference of the current form is easy to get. Just use the this keyword.
When you create a form you get a reference to that form:
Form f = new MyOtherForm();
When you create a form where you have modified the constructor to accept a reference, you just pass the reference when you create it:
Form g = new MySpecialForm(this);
or
Form g = new MySpecialForm(f);
---
b { font-weight: normal; }
|
|
|
|
|
Hi!
I have an applicatin that needs 2 forms. The first one is the login form and the next one is the main application form. What I need is to pass the login info from the first form to the main form. I've done that by creating for the main form a new constructor that gets 2 parameter, but I don't think it's a good ideea because when i'm creating an object of the main form from the login form if I close the login form the main form it's closing too. I've tried to hide the first form after initiating the main form, but then when I close the main form I can't (or I don't know how to) close the login form.
I would realy apreciate some sugestions. I'm a beginner in C#.
Thanks!
|
|
|
|
|
Open the login form as a modal dialog from the main form.
---
b { font-weight: normal; }
|
|
|
|
|
|
Create the form object and use the ShowDialog method to show it.
---
b { font-weight: normal; }
|
|
|
|
|
<br />
private void main_Load(object sender, System.EventArgs e)<br />
{<br />
LogingForm temp =new LogingForm(); <br />
temp .ShowDialog();<br />
if(temp .CheckLogin() == true)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
}<br />
Tamimi - Code
|
|
|
|
|
hello.
i`ve loaded an assembly file (dll) through reflection and tried to create an instance of one of its classes using Activator.CreateInstance.
i got this message:
"Could not load file or assembly 'dll_test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
please,help...
-- modified at 5:41 Saturday 3rd June, 2006
|
|
|
|
|
Well, it's really all in the error message. Either it can't open the DLL because there's something wrong with it (can't find it, it conflicts with another loaded DLL, etc.), or it has dependencies that can't be found.
Do you have the code for dll_test? Show us some code.
Also, are you just trying to load it once per app domain? Attempting to load it twice would give you an error like this.
|
|
|
|
|
hi
i have a swf file that contain 4 button.i want to work with them and implement 4 different reaction.
i use of following code:
but when i click on these button fscommand event dont call!!!!
private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
{
lbl_Result.Text="The "+e.args.ToString()+" "+e.command.ToString()+" was clicked";
}
|
|
|
|
|
Hi.
I have several xml files with a flat structure that I want to load into a class that I'm making. Is it possible to convert one of them into a framework of a class, so I don't have to do all the work manually?
Thanks in advance
Christian
|
|
|
|
|
There are tools that will infer XML schemas (XSDs) from XML data files. The .NET framework has these features built in as well. System.Data.DataSet.ReadXml() has an option to infer the schema, as well as to write the schema in the WriteXml() method. You could write a quick-and-dirty application that reads your file, inferring the schema, and writes it to a file. Once you have that, you can use the xsd.exe tool (or the version built into VS.NET) to build a typed DataSet, that will essentially act as a class.
If you need specific code, explain which part you're stuck at.
|
|
|
|
|
Stephan Samuel wrote: (or the version built into VS.NET)
Where do I find that tool?
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi every one...
I have understood how to make a network chating program(send receive) using socket class but what could i do other than chating?..What is the next level? and could i perform it in the same way?
"I am too late but i will never give up"
|
|
|
|
|
You can 'do' anything you want. Since you only need client events to be triggered by some sort of nudge, you could quite easily code anything you want into it (game, service, event, literally anything) and have this triggered by specific information sent from the server or other client connected p2p, by your Protocol.
All you need to do is select/design the Protocol.
[edit]
What is next level? : limited by your imagination.
Could it ferform in same way? : Depends what you mean by perform? Bandwidth? Client side stress?, Server Stress? Client Connections? etc.
[/edit]
-- modified at 4:39 Saturday 3rd June, 2006
|
|
|
|
|
Thank you very much for these valuable informations.
Could you lead me to an article which could help me to make my knowledge about socket programming better..especially for understanding handling clients events.
"I am too late but i will never give up"
|
|
|
|
|
Hello!
i just started to write a windows service.
i put in the OnStart method the things i want to do, but it doesn't work..
any suggestion?
Thanks
Enrico
VentoEngine corp.
Program your life ^^
|
|
|
|
|
Enrico,
Unfortunately, writing a Windows Service isn't as easy as writing anything else in the .NET framework. You need an installer project to install your service. Once installed, it should at least show some signs of life.
ventomito wrote: but it doesn't work..
What part doesn't work? Do you get an error message? What does or doesn't happen, and what are you doing to try to get it to work? Can we see some of your code?
|
|
|
|