|
thatdiceygirl wrote: the GC must have already tidied up the SeparateClass at this point?
I don't think so, static classes never get collected at all by the GC, once the class got referenced its statics are initialized and never disappear, until the process vanishes at the Windows level.
I'm afraid you haven't figured out yet what is really going on. And I can't tell you from what you told us. Any chance your DLL is loaded through reflection, and calling its stuff is using some more code (and data) than my example does?
thatdiceygirl wrote: have to refactor anyway,
I agree. I wouldn't want a DLL to call Application.Exit(), DLL classes should be accommodating, not lethal.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Yeah the SeparateClass definition DLL is loaded via reflection, and instantiated using an interface defined in a common assembly.
foreach (Type type in assembly.GetTypes())
{
if (type.IsClass == true)
{
SeparateClass = Activator.CreateInstance(type) as ISeparateClass;
}
}
The TraceString property is called through the interface and returns a StringBuilder object, hence the .ToString() call.
A girl in Engineering AND IT?!...what is this nonsense?
|
|
|
|
|
OK, then some part of your reflection stuff is failing while the app is winding down. AFAIK there isn't a fundamental reason why ApplicationExit would be different from anything else.
If you want to go to the bottom of this, better show all relevant code including the type definitions and their scope.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi,
How to take database back up from asp.net.
i try BACKUP DATABASE [tablename] To DISK = [path]
using stored procedure and query text
exception shown - "Cannot perform a backup or restore operation within a transaction.BACKUP DATABASE is terminating abnormally"
Cant we able to take database back up from code behind in asp.net
Thankyou
Yesu
|
|
|
|
|
Try posting your query in the correct forum, this is a Database question.
I must get a clever new signature for 2011.
|
|
|
|
|
I hopes i posted it in the right forum. I need to take back up from 'ASP.NET'. The query is working fine from SQL Server Management Studio
|
|
|
|
|
Yes i need to initiate the database backup from a asp.net webpage.
|
|
|
|
|
you can use SQLDMO library to take the backup in asp.net application..
HELLO GUY
|
|
|
|
|
Well as you can see, this is neither the Database nor the ASP.NET forum.
I must get a clever new signature for 2011.
|
|
|
|
|
You want a backup that is initiated in "ASP.NET"? Are you trying to initiate the database backup from a webpage?
|
|
|
|
|
you can use SQLDMO library to take backup using asp.NET application..
HELLO GUY
|
|
|
|
|
Hey guys!
In my setup project, I want my software to appear in the [Open With] context menu for a certain file extension, however if I do so, the file association makes my software the default file association in Windows for that particular extension. I Do want windows to associate my software with the file extension, but I don't want my setup to change the default association for that file extension.
Is that possible?
|
|
|
|
|
Meaning "Don't change the association if one already exists, but create an association if it doesn't"?
Me, I'd avoid doing it during Setup, and just have your application check to see if the file association is there, then prompt the user asking if they would like the assocation created or changed, as appropriate. (Kind of like email programs do if they find they're not the deafult mailer, or Quicktime with image types, etc.)
|
|
|
|
|
The solution is to change the verb of the file association's action to openas in stead of open. The openas verb makes your software appear in the 'Open With' context menu, but doesn't change the default file association which is exactly what I wanted.
Thanks for your reply!
|
|
|
|
|
|
I found the solution ( this[^] message explains more)
Thanks for your reply!
|
|
|
|
|
Hi ,
I have a search on my form[say,parent form]. When I click on search button ,I want to display the results in a modal window and return the selection back to parent form and populate controls with the returned data.
Any suggestions would be appreciated.
Thanks
|
|
|
|
|
This[^] shows how to do what you want. It uses a string, but you can pass any type you wish.
|
|
|
|
|
Do it with events. When the data is returned, post a custom event, and have the first form hook that event and perform the appropriate processing.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
As an alternative, you could create a static class. Just make a form with a textbox, and a button with "DialogResult" set to "OK", and a static wrapper...
public partial class Input : Form
{
public Input()
{
InitializeComponent();
}
public string StringValue
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
}
public static class InputBox
{
private static Input _input = new Input();
public static DialogResult ShowDialog(string caption, ref string value)
{
_input.Text = caption;
_input.StringValue = value;
if (_input.ShowDialog() == DialogResult.OK)
{
value = _input.StringValue;
return DialogResult.OK;
}
return DialogResult.Cancel;
}
}
Then use it like this...
private void button1_Click(object sender, EventArgs e)
{
string x = "Some default text";
if (InputBox.ShowDialog("Test", ref x) == DialogResult.OK) MessageBox.Show(x);
}
|
|
|
|
|
That has to be one of the most inappropriate uses of static I have ever seen.
Why on earth would you do it that way, when a simple public property in your Input class (which you already have) does the same thing?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I assume you mean to do something like this?
private void button1_Click(object sender, EventArgs e)
{
Input inBox = new Input();
inBox.StringValue = "Some default text";
if (inBox.ShowDialog() == DialogResult.OK) MessageBox.Show(inBox.StringValue);
}
|
|
|
|
|
Yes. Either that way, or with a constructor requiring the header and default text.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
From what I was reading, it looked like he was asking a question similar to this one. Perhaps he wasn't, my mistake.
The purpose of the static class is to give it "MessageBox-like" usage; e.g., you don't have to use "new MessageBox() " to instantiate that dialog, you can simply call one of the "MessageBox.Show() " overloads.
Regardless, the code I listed above is not thread safe. Here would be a better version:
public partial class Input : Form
{
public Input()
{
InitializeComponent();
}
public Input(string caption, string defaultValue) : this()
{
this.Text = caption;
textBox1.Text = defaultValue;
}
public string StringValue
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
}
public static class InputBox
{
public static DialogResult ShowDialog(string caption, ref string value)
{
Input inForm = new Input(caption, value);
if (inForm.ShowDialog() == DialogResult.OK)
{
value = inForm.StringValue;
return DialogResult.OK;
}
return DialogResult.Cancel;
}
}
And a usage example (with threads):
private void button1_Click(object sender, EventArgs e)
{
new Thread(new ParameterizedThreadStart(doMessage)).Start("one");
new Thread(new ParameterizedThreadStart(doMessage)).Start("two");
}
private void doMessage(object msg)
{
string x = msg.ToString();
if (InputBox.ShowDialog("Test", ref x) == DialogResult.OK) MessageBox.Show(x);
}
|
|
|
|
|
All your static class is doing is moving the instantiation out of the original class, and making the input message harder to use.
It also depends on the (unknown) Input form to return "OK" or "Cancel" rather than "Yes", "No" or "Cancel".
Why make it static? If all you want to do is hide the instantiation, put it in s non-static method and you get exactly teh same result, but better contained. You could make that static if you really wanted to, but I wouldn't necessarily bother.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|