|
That would completely eliminate the reason for having the DLL.
The DLL has it's own config file because the settings in that config file only apply to the DLL, and are otherwise invisible to the app that uses the DLL.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John - by default, the DLL config file is ignored. In order to actually do this, you have to load your DLL into its own AppDomain and use remoting to use the DLL. Here's a sample to get you started:
private _myClass;
public void SetupDomain(string configFile, string domainName)
{
AppDomainSetup setup = new AppDomainSetup();
setup.ConfigurationFile = configFile;
AppDomain domain = AppDomain.CreateDomain(domainName, null, setup);
_myClass = (MyDllClass)domain.CreateInstanceAndUnwrap("MyDll", "MyDll.MyDllClass");
} You could call this like:
SetupDomain("MyDll.Dll.Config", "My domain");
int value = _myClass.GetConfigItem();
|
|
|
|
|
I did it this way (the code below was abstracted a bit to keep it from overwhelming CP):
public class MyLibClass
{
private string m_configName = "MyLib.dll.config";
private string keyName = "APP_CONFIG_FILE";
public MyLibClass()
{
Reload();
}
public void Reload()
{
string configPath = System.IO.Path.Combine(Environment.CurrentDirectory, m_configName);
string appConfigFile = AppDomain.CurrentDomain.GetData(keyName).ToString();
AppDomain.CurrentDomain.SetData(keyName, configPath);
string xyz = ConfigurationManager.AppSettings["mySetting"];
AppDomain.CurrentDomain.SetData(keyName, appConfigFile);
}
}
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
how to make call for play recorded .wav file in linux asterisk server using asterisk.net?i have tried with playback() funtion as well as monitor() function but it cant work.please help me if anybody knows?
|
|
|
|
|
I use the PlaySound API function to play wav files, but I've only used it for local media.
[System.Runtime.InteropServices.DllImport ( "Winmm" , SetLastError=true , EntryPoint="PlaySound" )]
private static extern bool
API_PlaySound
(
string pszSound
,
System.IntPtr hmod
,
uint fdwSound
) ;
|
|
|
|
|
i am accessing the xml file through the c# in tree view. so how can i save the changes which ihave made in tree view in xml file?
|
|
|
|
|
when you read the file first time save the information with your self.
e,g save it in string what changing you are you going to made now you can easly change the string at the last you can write down you whole file again.
This is my idea i am working in this way.
|
|
|
|
|
can u plz send me sample code?
|
|
|
|
|
Look at the following overloads for the XmlDocument.Save() method. http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.save(VS.80).aspx[^]
I hope you were using the XmlDocument class to make the changes to the original XML. If you aren't, then you should definitely take a look there as it will make things easier for you.
I just realized you said you were using a databound treeview to access the XML. I've never actually used that, so ignore my response.
|
|
|
|
|
|
How to set dateformat in DataGridView column.
Which property need tobe changed or any other alternative???
|
|
|
|
|
You should change the date formate before putting the data into grid view.
If you are getting data from database then you should change your system date style formate.
|
|
|
|
|
But i want to write date manually in DataGridView how to do this???
|
|
|
|
|
There's a Format property in the DefaultCellStyle property in the GridViewColumn for setting the format.
|
|
|
|
|
|
I want to create custom picturebox in which i enter mouse i become inlage and as mouse leave in go in it previous size.
The problem did't want to big its size area.
I mean there are also other picturebox.
The example of my control that i what to create In mobile main menue.
In which which item you selected it will become large and over become over to nearest items.
rect.Inflate(2, 2);
is a technique but it not solving my problem.
Waiting for your comment ...
Thanks
|
|
|
|
|
Have you come up with any good ideas?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I get the answer form the msdn forms the link is
here]
|
|
|
|
|
Cool, and thanks for sharing
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I am using a property Grid with a check Box displayed as one of its item.
I am able to display Check Box and check/Uncheck Items.
But the problem is I am also getting a drop down List box with True/false along with check box. I need to get rid/hide this drop down List Box .
Can any pne please let me know for the soultion if possible ?
the code I am using for displying Check Box is:
[Editor(typeof(CheckBoxInPropertyGridEditorTwoPassCalc), typeof(System.Drawing.Design.UITypeEditor))]
public bool TwoPassCalculation
{
get { return twoPassCalculation; }
set { twoPassCalculation = value; }
}
public class CheckBoxInPropertyGridEditorTwoPassCalc : UITypeEditor
{
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return true;
}
public override void PaintValue(PaintValueEventArgs e)
{
ControlPaint.DrawCheckBox(e.Graphics, e.Bounds, ((GeneralDimensionClass)e.Context.Instance).twoPassCalculation ? ButtonState.Checked : ButtonState.Normal);
}
}
modified on Wednesday, January 23, 2008 4:28:13 AM
|
|
|
|
|
Are you still working on this?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
how do i delete the selected node programmatically in tree view?
|
|
|
|
|
<br />
treeview.Nodes.Remove(treeView.SelectedNode);
|
|
|
|
|
Hi All
Last Mounth I Creat BackUp DataBase From Microsoft SQl Server 2005 By C#.Net Code .
But Know I Wount To Restor This BackUp From Device To Microfoft SQL Server 2005 By C#.Net Code .
Who Can Hellp Me By Support me By C#.Net Code ?
Thanks For Any Body Hellp me
Thaer
|
|
|
|
|
using Microsoft.SqlServer.Management.Smo;<br />
private static Server srvSql;<br />
private static ServerConnection srvConn;<br />
Coeenction
<br />
servername = cmbServer.Text;<br />
srvConn = new ServerConnection(cmbServer.SelectedItem.ToString());<br />
srvConn.LoginSecure = true;<br />
<br />
srvSql = new Server(srvConn);<br />
//Restoring Database
void Restoring_data()<br />
{<br />
<br />
if (srvSql != null)<br />
{<br />
<br />
Restore rstDatabase = new Restore();<br />
rstDatabase.Action = RestoreActionType.Database;<br />
rstDatabase.Database = "DataBaseName"<br />
BackupDeviceItem bkpDevice = new BackupDeviceItem(txtbackup.Text.ToString(), DeviceType.File);<br />
rstDatabase.Devices.Add(bkpDevice);<br />
rstDatabase.ReplaceDatabase = true;<br />
<br />
rstDatabase.SqlRestore(srvSql);<br />
<br />
}<br />
else<br />
{<br />
MessageBox.Show("A connection to a SQL server was not established.", "Not Connected to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);<br />
}
Hope this will help your
|
|
|
|