|
WinForms does use ShadowCopy. Actually, the .NET framework itself uses this method also. When an assembly is loaded from the GAC it is really using a shadowcopy, this allows assemblies in the GAC to be updated without the risk of being locked by an application.
Using the AppDomainSetup object you can set the path and whether or not to use shadowcopy when creating a new AppDomain. I have used this method to load assemblies for use in an application and allow them to be updated while the app is running. If the assembly is updated the AppDomain is unloaded and created again there by getting the newer version for use while the app remains active for the user.
|
|
|
|
|
Thanks for the info! I never knew that.
:josh:
My WPF Blog[^]
|
|
|
|
|
Hi,
Thanks for your information. Please i need the sample code which you are using for shadow copying.i have tried the same.But newer version is not updated.
|
|
|
|
|
I have a Windows Form (Form1 is class name) which is the GUI for my app. In Form1 class I have some methods for writing to a textbox. In the same namespace I have another class from which I would like to call Form1's method for writing to that textbox.
Question: How can I call Form1's methods from the another class. I understand how to make calls across classes using instances, but how can I do this when I dont have an instance of Form1 in the other classes? I've tried using static modifiers to Form1's textbox function but that brings up other problems.
So how can I access the Form1's members and methods from another class??
Thanks
|
|
|
|
|
You'd have to find a way to get a reference to the running form. Don't know how you would accomplish that unless the form is instantiating the class in question.
However, what you described sounds like a design choice you should probably reconsider. Instead of having a class that alters a text field, you might want to have that class just take some input and return a string so that any form with a text box can use that functionality.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
First, although there are other alternatives, in your case it's better for other classes to call Form1 object. Static methods are not a good option here, as you may want to handle multiple Form1 instances.
Second, Form1's data members aren't supposed to be accessed/altered directly by other classes. A better design would be adding Property to Form1. Outsiders access Form1 properties and Form1 binds these properties with its own controls.
Best,
Jun
|
|
|
|
|
Jun Du wrote: A better design would be adding Property to Form1. Outsiders access Form1 properties and Form1 binds these properties with its own controls.
Not much better, a better design would use MVC Pattern.
|
|
|
|
|
Hello alll
I need to find 24 Hrs back DateTime using C#. How to do this.
regards
GV Ramana
regards
GV Ramana
|
|
|
|
|
DateTime back = DateTime.Now.Subtract(new TimeSpan(24, 0, 0));
|
|
|
|
|
May be a little ugly but:
System.DateTime dtYesterday;<br />
dtYesterday = System.DateTime.Now.AddHours(-24);
|
|
|
|
|
Not ugly at all. The method accepts negative values becase you are supposed to use them.
---
b { font-weight: normal; }
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Hello!
When I try to execute a program sometimes it doesn´t work, and if I stop the debug the program that I wanted to be executed initializes =/. It really annoys me!!
What is happening?
Process.Start(ProgrammePfad, AuftragsVerzeichnis);
or
Process p = new Process();<br />
ProcessStartInfo startInfo = new ProcessStartInfo();<br />
startInfo.FileName = ProgrammePfad;
startInfo.Arguments = AuftragsVerzeichnis;
startInfo.ErrorDialog = true;<br />
startInfo.WindowStyle = ProcessWindowStyle.Normal;<br />
<br />
<br />
p.StartInfo = startInfo;<br />
p.Start();
Both of them sometimes work, sometimes don´t! =/
The program that I want to be executed is called InTouch WindowMaker.
Thanks!
Regards
|
|
|
|
|
suguimoto wrote: When I try to execute a program sometimes it doesn´t work,
Are you trying to communicate with the program that you try to execute? If not, what exactly does "it doesn't work" mean?
You could try calling WaitForInputIdle[^] right after starting the process and see if it helps.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I am creasting an application where I am implementing "search and replace word" functionality. I have a dialog "SearchAndReplace" which takes two text inputs and has three buttons as "FindNext", "Replace" and "Close"
I have implemented following code in my main form:
My main class code is:
<br />
if (SearchReplaceDialog.ShowDialog() == DialogResult.OK)<br />
{<br />
if (SearchReplaceDialog.WithReplace)<br />
{<br />
int c = this.Editor.Replace(SearchReplaceDialog.Search, SearchReplaceDialog.Replace, SearchReplaceDialog.Match, SearchReplaceDialog.Word, SearchReplaceDialog.Up);<br />
MessageBox.Show(c.ToString() + " strings found and replaced");<br />
} <br />
else <br />
{<br />
bool r = this.htmlEditor1.Find(SearchReplaceDialog.Search, SearchReplaceDialog.Match, SearchReplaceDialog.Word, SearchReplaceDialog.Up);<br />
if (!r)<br />
{<br />
MessageBox.Show("String '"+SearchReplaceDialog.Search+"' not found");<br />
}<br />
}<br />
}<br />
SearchDialog code:
<br />
private void btnFindNext_Click(object sender, System.EventArgs e)<br />
{<br />
Match = this.chbMatchCase.Checked;<br />
Word = this.chbMatchWholeWord.Checked;<br />
Up = this.chbSearchUpward.Checked;<br />
Search = this.txtFindWhat.Text;<br />
Replace = this.txtReplaceWith.Text = String.Empty;<br />
WithReplace = false;<br />
<br />
DialogResult = DialogResult.OK;<br />
}<br />
When I click Find Next, the Search and replace dialog box closes. I want to retain it on top of application and close the dialog when user closes it on Clicking "Close" button.
Can anyone please suggest my how can I achieve this?
Thanks
|
|
|
|
|
Set the property "DialogResult" to "None" for "FindNext" Button.
|
|
|
|
|
As stancrm me eluded, setting DialogResult to DialogResult.OK is what's closing the form. As he suggested, you can set it to DialogResult.None, or don't set it at all on Find Next.
Your question gave the impression that you also need help getting information from the dialog form. You could have it publish events to notify the using form of the information in a match on Find Next, which would help you accomplish that.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
I would like to ask user name and password when accessing to database with login prompt but seems that there doesn't exist the same mechanisn than eg. earlier VB connection object. (like connection.Properties("PROMPT") = adPromptComplete)
This kind of login form would be useful especially in situation when I get default connectionstring with Integrated Security=SSPI and that doesn't work...
C# connection object doesn't have properties property??
-- modified at 8:35 Wednesday 5th July, 2006
|
|
|
|
|
jaskatpl wrote: This kind of login form would be useful especially in situation when I get default connectionstring with Integrated Security=SSPI and that doesn't work...
This is not a "default" connection. It means you connect using the rights associated with the security context the calling application is running within. Typically, for a windows application, this will be the account you logged on with.
jaskatpl wrote: C# connection object doesn't have properties property??
C# is a language, the .NET Framework has a number of connection classes. I'm assuming you are referring to SqlConnection. You can set the connection string to contain a username and password if you want. All you have to do then is to create a dialog to accept a username and password and use that when you are building a connection string.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
Ok.. sorry about some inaccuraties but let's say that I have my default connnectionstring in my specific application. Now my "default" connectionstring have keyword Integrated Security with value SSPI and I test connection when I am contsructing object from my DataAccesLayer. The test fail and I want to use eg. sql server autentication with used id and password as "backdoor". There have been "automatic" mechanism for this earlier and now I'm wondering why it doesn't exist(or I simply could't find it)
Colin Angus Mackay wrote: All you have to do then is to create a dialog to accept a username and password and use that when you are building a connection string.
Yes.. exaclty. It's very easy but I still would like to find some other way ...
|
|
|
|
|
jaskatpl wrote: Now my "default" connectionstring have keyword Integrated Security with value SSPI and I test connection when I am contsructing object from my DataAccesLayer. The test fail and I want to use eg. sql server autentication with used id and password as "backdoor".
Then you need to supply different connection strings for different scenarios. "Backdoors" are a form of security violation and I trust that you didn't really mean "backdoor" in that sense. You can put the connection string in to the app.config and when you are running your application in side the test framework (I use NUnit) you can supply a different config file. For example, if you open a test assembly in NUnit it will pull in an app config file with called assemblyname.dll.config
jaskatpl wrote: There have been "automatic" mechanism for this earlier
There has, to my knowledge, never been an automatic mechanism for this.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
->backdoor
I'm not very familiar yet with these english terms so thanks for correcting.
I have always just one connectionstring that I read from .ini-file and I cannot
change that because there is many other applications that are using the same
value. Sometimes the windows autentication fails and that's why I need sometimes login prompt.
Colin Angus Mackay wrote: There has, to my knowledge, never been an automatic mechanism for this.
What I really mean is this:
http://support.microsoft.com/default.aspx/kb/200886[^]
Old ADO supports this but I haven't found it from ADO.NET...
-- modified at 2:00 Thursday 6th July, 2006
|
|
|
|
|
|
Colin Angus Mackay wrote: ADO.NET isn't a continuation of the old ADO. The only thing that is shared between the two is part of the name.
some people have an other opinion:
-> There are a number of similarities between ADO.NET programming
-> and ADO (not only the name), so upgrading from ADO shouldn't be too
-> difficult.
http://www.stardeveloper.com/articles/display.html?article=2002042001&page=1[^]
but ok, I don't want to argue with that. The result is that I have to code the login prompt myself.
|
|
|
|
|