|
As a hack you could load it as an out of process COM server, but it's bad and wrong, just upgrade the damn app already :P it'll be worth it in the long run. There were very few breaking changes between 1.1 and 2.0 so theres not much excuse for not upgrading.
|
|
|
|
|
Thanks to All of you.
After doing lot of R&D and Spending lot of time on it, finally I come to the decision that I will upgrade existing applications to Framework 2.0.
Thanks Again.
|
|
|
|
|
I have a GUI utility and it connects to a sql server 2005 database. All of the connection code has been generated by the IDE.
I have 2 databases one for produciton and one for development. How can I switch the connection string? I am currently doing it in the Settings.Designer.cs file and checking for
#if DEBUG
//use the dev server
#else
//use the prod server
#endif
however everytime i alter the settings.settings file the IDE rewrites the Settings.Designer.cs file.
this is how the code currently works:
currently when i start my application the connection string is initialized like this:
this is called:
internal System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
which calls this:
private void InitConnection() {
this._connection = new System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::DGView2.Properties.Settings.Default.ProdConnectionString;
}
which calls this:
public string ProdConnectionString {
get {
return ((string)(this["ProdConnectionString "]));
}
}
app.config file:
<connectionStrings>
<add name="DGView2.Properties.Settings.ProdConnectionString"
connectionString="Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=True"
providerName="System.Data.SqlClient"
<add name="DGView2.Properties.Settings.DevConnectionString" connectionString="Data Source=localhost\DEV;Initial Catalog=MyDatabase;Integrated Security=True" />
</connectionStrings>
I guess part of the problem is that this line of code:
this._connection.ConnectionString = global::DGView2.Properties.Settings.Default.ProdConnectionString;
is always calling: public string ProdConnectionString
so in my Settings.Designer.cs file I have set it up this way:
public string ProdConnectionString {
#if DEBUG
get { return ((string)(this["DevConnectionString"]));}
#else
get { return ((string)(this["ProdConnectionString"]));}
#endif
}
I am not convinced that this is the best way to do it. The ideal situation I think would be to use the desired property based on DEBUG or RELEASE in the call to the connection string:
#if DEBUG
this._connection.ConnectionString = global::DGView2.Properties.Settings.Default.DevConnectionString;
#else
this._connection.ConnectionString = global::DGView2.Properties.Settings.Default.ProdConnectionString;
#endif
however there are just to many instances of this therefore making it less efficient.
any suggestions?
thx
|
|
|
|
|
You may need to look in the App.Config file...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
i am looking in the app.config file that's where the settings are stored...that's not the problem
thx for your help tho
|
|
|
|
|
The normal way of doing this is to just use one setting. You change the config file, so that you have a debug version and a release version.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I second what Pete said - use one setting, called ConnectionString and edit the file depending on whether you want it to work on Dev or Prod.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
thanks to all for the replies...i will stick with one connection string
|
|
|
|
|
Heres a simple one im making a startup forum which asks for a password when the user clicks on the trey icon , if the password is accpted the value Authenticated is set to true and the trey icon menu is enabled
the problem being the whole multi form thing i cant change the value of Authenticated in the native form , Can anyone tell me how to get this working ?
//Native form
private bool Authenticated;
private void TreyIcon_Click(object sender, EventArgs e)
{
Authenticated = false;
if (Authenticated == true)
{
this.TreyIcon.ContextMenuStrip = this.TreyMenu;
}
else
{
Authentication form = new Authentication();
form.ShowDialog();
}
}
//remote form
private bool Authenticated;
private void Authenticate(object sender, EventArgs e)
{
if (Password1.Text == "pass")
{
MessageBox.Show("Password accpted", "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
Authenticated = true;
}
else {
Application.Exit();
}
}
|
|
|
|
|
Raymond_P* wrote: i cant change the value of Authenticated in the native form , Can anyone tell me how to get this working ?
Not sure, but as an observation, I wouldn't have the password out in plaintext when you have your program go live
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
well its just some basic protection the app has my ftp credentals it updates a flash websites xml files . Its manly to detur anyone who uses my laptop like family. I wont be giving it to anyone else
im sure its simple ive dine this before but ive forgoton how
|
|
|
|
|
Raymond_P* wrote: Its manly to detur anyone who uses my laptop like family. I wont be giving it to anyone else
Okay, simple enough
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Dear All,
Need help to get the root/home directory of an FTP site configured on IIS 6.
Now so far i have been able to get each and every information such allowed via the WMI provider but am still unable to find any information to get home/root directory for ftp site.
Thank you!
M. Nauman Yousuf
|
|
|
|
|
Hi all?
Can IIS 7.0 be installed on windows vista?
Is there an option called Windows authentication on IIS 7.0?
Regards
|
|
|
|
|
Google search: IIS 7.0 on Windows Vista[^] should be of help. As long as you have Vista Business or Ultimate.
BTW, do you have a C# question? You are in the wrong forum...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Seems like you have cross-posted before and not gotten the message. I am virtually hitting your nose with my rolled up TechNet magazine. Now go to the corner and read the forum guidelines.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
leckey wrote: I am virtually hitting your nose with my rolled up TechNet magazine
Too bad I couldn't tie a rock or brick to my message I posted hurled earlier
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
How can i kill a module without terminating its process?....
|
|
|
|
|
what do you mean by module here ?
you can abort or kill a thread (not a very good idea).
you cant unload a class or assembly, but you can create a new AppDomain, load it, then
remove it (with everything thats in it).
|
|
|
|
|
Then how can I know if a thread belongs to a cirtain dll/module. Its very important to me since a dll that I activate causes a crash at shotdown.
|
|
|
|
|
A thread does not belong to anything, it is a living being.
It gets created by some code, that code probably sits inside an EXE or a DLL file.
Tossing out the code at run-time will not achieve the result you are after.
whay do you mean by shotdown: is it the app wanting to terminate by itself,
is it you telling the app to terminate, or is it you telling the PC to shut down (and
then the PC telling all the apps and services of this fact) ?
Did you create the EXE and the DLL files, so you can change the source files (and
correct whatever you did wrong in the first place, if anything) ?
Things to do depend on the answers.
|
|
|
|
|
You can load that dll into its own app domain. Then you can shut down that app domain.
Ben
|
|
|
|
|
You can load this DLL, or whatever it is, into it's own AppDomain, but that's not going to stop it from crashing. And, it's more than likely not going to stop an error message from popping up either.
|
|
|
|
|
Hi,
I have some .html templates, when the Form is submitted the code creates the document and modifies certain portions of the document with information obtained from the fields in the code.
What is a better way to do this, will XML help at all? I'm presently using StringBuilder to develop the content. Ideally I could reopen the documents and quicky make changes rather than re-create them each time.
|
|
|
|
|
One way would be to have a template file with the sections that you want to replace marked out with unique text, then do a find/replace on this.
private string Replace(string item, string replace, string text)
{
if (item == null || item.Trim() == string.Empty)
return string.Empty;
return Regex.Replace(item, replace, text, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
} This is a method to do a replace based on a regular expression. Call this as:
text = Replace(text, "^^ Unique Text ^^", "My replacement text");
Deja View - the feeling that you've seen this post before.
|
|
|
|