|
Even if you are opening 2 copies of notepad they are copies not the same exe.
Yes, I understand that they are copies, even if you run the same executable twice.
What I don't understand, however, is what you mean by "2 forms as applications from the same stub". My first form is being launched from the process I double-clicked. That one's pretty simple to understand. My second form is being launched when I create another process, so from what I understand, it is completely separate, since I'm only using the first process to call the second process. Let me see if I can give an example of this... it would sort of be like cmd.exe. When you run it, a form pops up that's designed to be like a command prompt. Then, you enter some text into this command prompt, say "notepad.exe", and it opens up notepad as a new process, and the form of notepad is on top of the form for the command prompt.
If my example is not a good one, could you please elaborate further? What I just gave above seems to make logical sense to me...
|
|
|
|
|
Same issues applies, you are running cmd.exe to get the dos prompt and from there you want to run notepad.exe. You are hitting 2 different exe files.
Your application compiles into 1 exe and from that your want to run 2 applications. Do you want 2 apps or do you want 1 app with 2 threads.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I think that that Form.Activate method might do what you require. This brings a form to the front of Windows so that it would appear on top of anything that you have open.
I have been using this from a notiify icon so that that double clicking the icon will bring the form to the z-order of all open windows apps. I assume this will work for threads within the same application but I haven't tried that (I'm not too familiar with threading code)
Bye.
|
|
|
|
|
Hi,
This worked for me. What I was doing before was:
Form2 form2 = new Form2();
form2.BringToFront();
Application.Run(form2);
Then, I tried:
Form2 form2 = new Form2();
form2.Activate();
Application.Run(form2);
This didn't work either, so I tried:
Form2 form2 = new Form2();
Application.Run(form2);
|
|
|
|
|
Application: I have a Windows forms application which interacts with COM components to update data in the Oracle DB.
Whenever I try to update the data based on a condition it never works in the full run using the release exe. But when I try the same thing through step by step debugging of the release exe, it works fine and updates the DB.
This appears quite strange and inconsistent. Can someone throw light on this?
Regards,
SPanicker.
|
|
|
|
|
SPanicker* wrote: Whenever I try to update the data based on a condition it never works in the full run using the release exe.
SPanicker* wrote: Can someone throw light on this?
Does the information in your applications logging data suggest anything?
led mike
|
|
|
|
|
You may be running in to a case where the runtime is being too agressive and running a GC too soon. How are you acessing the COM components? If you're doing this in a managed wrapper, it should implement IDisposable and include calls to GC.KeepAlive() in the appropriate functions.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Mike/Dorman thnx for the great inputs. I have looked into all of these issues but I find no clue why this is happening.
Is this some kind of weird inconsistency which is particular to .NET 2.0+Win2000 I am using???
Regards,
SPanicker.
|
|
|
|
|
Hello, is it a good way (and easy) to use skins (visual styles) in c# with .net ?
I have a custom control called XPExplorer Bar : http://www.codeproject.com/KB/miscctrl/XPTaskBar.aspx
It's a great control and to use a skin with it (from a .dll that contains an UI file) I just use something like :
taskPane1.UseCustomTheme("themes/4.dll");
If I use the above line the visual style from the DLL is applied to the control.
I would like to do the same with the TopMenu (the menu strip) and other buttons/controls ...
I hope some one can guide me with this, thanx
|
|
|
|
|
It is not as simple as that for using visual styles in applications as everything is drawn using the uxtheme WinAPI within Windows XP/Vista.
One of my articles might be able to assist with a different method of theming controls with WinForms. Theming in general gets easier with WPF, but even then you are not able to alter aspects using visual styles of the uxtheme engine.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I'm in need of a deployable database solution for my Windows Forms projects. VS.NET has Local Database (.sdf) which asks you to install SQL Server Pocket Edition and Service-based Database (.mdf) which requires SQL Server Express to be installed. What can I use for my project that I can deploy in a setup?
|
|
|
|
|
You can just deploy an access DB, I thought. But, that is an mdf file. I guess they are moving away from that, because it sucks. I thought there was also a SQL Server embedded, which becomes part of your exe, but I am vague on the details, I keep meaning to look into that for my app.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
I writing a application about Gene. But I don't know how to read FlatFile format(source to [^]) get into database. I need help by everybody about that. Thanks.
modified on Thursday, November 20, 2008 10:36 PM
|
|
|
|
|
Hi all,
I have a windows application in client machine.I want to invoke(windows app screen should also be visible)that windows application(client machine) from server machine. Here both client and server machines are in LAN and WAN.
Problem:
1.Invoke the windows application(windows app screen should also be visible in client machine) from server machine.
2.After application opens in client machine,then user enters some data,that data have to be written to a file which is in server machine.
I succeeded to solve the above problem using webservices
But suddenly I was asked to solve it using .net Remoting.....Iam new to .net remoting
kindly help me in solving the above problem using .net Remoting
|
|
|
|
|
|
balu12345 wrote: kindly help me in solving the above problem using .net Remoting
I am not going to do the work for you, nor can I open your head and pour in the knowledge you need to implement a .NET remoting solution. Perhaps you will have to go learn .NET remoting so you can use it, what do you think about that?
led mike
|
|
|
|
|
Hi Mike,
I not asking any readymade solution.
Just I need some start-up help.
Any how Thanks for your reply.Iam request you to not underestimate others.In forums no one can give complete solution,but memebers just give their idea and some valuable information(any links) for the beginners.
|
|
|
|
|
balu12345 wrote: I not asking any readymade solution.
Just I need some start-up help.
balu12345 wrote: Iam request you to not underestimate others.In forums no one can give complete solution
Really? And we are supposed to get that from your previous post, as follows:
balu12345 wrote: kindly help me in solving the above problem using .net Remoting
I don't think so Skippy.
led mike
|
|
|
|
|
Is that possible to localize list of values in Script combo of Font Dialog? Do we at all need to localize it?
Thanks.
modified on Wednesday, November 19, 2008 4:09 PM
|
|
|
|
|
I have a form that calls a dialogbox, Type, of the class dlgType. In the dialog box I have three radio buttons to select an equipment type, and a private variable - Selected - to contain the latest radio button selection. When the user clicks OK, the button handler assigns the value of Selected to a property called Choice. That's when the goofiness happens. Up to that point, Selected contains the correct value. But upon assigning Choice its value, the set function associated with Choice is called over and over again, causing a stack overflow error. I've watched it happen by stepping through the debug process (can I buy a replacement F11 key? I'm wearing this one out.) from the beginning of the code. The error definitely begins when the OK button is clicked and the set function is called. Can anyone suggest why this is happenning? And, by the way, I've tried it without the this prefix on Choice, too; same result. Here's the dialog code:
namespace SubMaint<br />
{<br />
public partial class dlgType : Form<br />
{<br />
public dlgType()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
private int Selected = 0;<br />
public int Choice<br />
{<br />
get {return Choice;}<br />
set {Choice = value;}<br />
<br />
}<br />
<br />
<br />
private void rbTransformer_CheckedChanged(object sender, EventArgs e)<br />
{<br />
if (rbTransformer.Checked == true)<br />
{<br />
Selected = 1;<br />
}<br />
}<br />
<br />
private void rbRegulator_CheckedChanged(object sender, EventArgs e)<br />
{<br />
if (rbRegulator.Checked == true)<br />
{<br />
Selected = 2;<br />
}<br />
}<br />
<br />
private void rbRecloser_CheckedChanged(object sender, EventArgs e)<br />
{<br />
if (rbRecloser.Checked == true)<br />
{<br />
Selected = 3;<br />
}<br />
<br />
}<br />
<br />
private void btnOK_Click(object sender, EventArgs e)<br />
{<br />
if (Selected > 0)<br />
this.Choice = Selected;<br />
<br />
}<br />
}<br />
}
Any assistance will probably save me some hair...
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Your problem is here:
public int Choice
{
get {return Choice;}
set {Choice = value;}
} In the set block, you are taking the assigned value, and setting to Choice, which calls the same bit of code again. A property isn't a way of storing data, it is a way of accessing data that is stored privately in the object. You need to add a backing storage variable for the data. Like this:
private int _choice;
public int Choice
{
get
{
return _choice;
}
set
{
_choice = value;
}
}
Here the private variable _choice is used to store the data. The public property Choice is used to get & set that data.
(If you are using VS2008, there is a kind of shortcut property. You can just write this:
public int Choice
{
get;
set;
}
and it will automatically manage the backing variable for the data storage itself. You still need a backing variable, but in this case it is basically a visual studio trick, when it compiles the code it will just create the backing variable for you. Personally, I don't like this though, I prefer to declare it all in full, I think it's clearer.)
Simon
|
|
|
|
|
That did the trick... Thanks!
Now to figure out how to get the value back to the form before the dialog closes...
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
No prob.
(You don't have to. Just use the property to get it after the dialog has been closed:
dlgType dialog = new dlgType();
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
MessageBox.Show(dialog.Choice);
}
)
Good luck.
Simon
|
|
|
|
|
That's essentially what I'm doing, but I'm getting an odd display. I think it's a casting problem; I'm returning an int, and using a message box to display the selected value for testing purposes. I thought I could cast the int with either (char)int or (string)int, but apparently that doesn't work. The display has a cute little square box where the digit ought to be. When I get home tonight I'm planning to play with Convert.ToString() instead, though I can't see why it should work when the more basic methods don't work. It's not really essential, though, as the message box won't be part of the program. So long as the int is being returned correctly, I'm happy.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|