|
I've got an application, and i want to to be able to spawn an AppDomain with it, and supply it with some Main method args that it can then use to connect to the creating app, and then continue execution as normal.
How do i do this when creating something using:
AppDomain.CreateDomain()?
Cheers
Tris
-- modified at 18:06 Sunday 26th March, 2006
|
|
|
|
|
How does one determine the version of windows that thier program is running on?
|
|
|
|
|
Look up the help on these ...
System.OperatingSystem os<br />
os = Environment.OSVersion<br />
This may also help CodeGuru article[^]
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Hi,
Ive seen alot of sourcecode and demos from msdn featuring code to access an sql server.
The code uses SqlDataAdapters, etc.
But Ive never seen code such as
sqlconnection.open();
or
sqlConnection.close();
I understand that as long as you feed an sqldataadapter a connection string, it will connect on it own.
However, my question is, how long does it stay connected for? Or does it require to be disconnected manually?
Or is it a case that the connection is dropped when the object is disposed?
Any thoughts
Andy
|
|
|
|
|
If a DataAtapter opens the connection, it will also close it. If you open the connection before handing it to the DataAdapter, you also have to close it yourself afterwards.
---
b { font-weight: normal; }
|
|
|
|
|
I have a DataGridView dataGridView1.
DataGridViewTextBoxColumn nCol;
nCol = new DataGridViewTextBoxColumn();
nCol.Name = "col1";
dataGridView1.Columns.Add(nCol);
nCol = new DataGridViewTextBoxColumn();
nCol.Name = "col2";
dataGridView1.Columns.Add(nCol);
And I want to add a row to it when I click a button so:
DataGridViewRow tempRow = new DataGridViewRow();
tempRow.CreateCells(dataGridView1);
tempRow.Cells["col1"].Value = "test1";
tempRow.Cells["col2"].Value = "test2";
dataGridView1.Rows.Add(tempRow);
But it returns error:
Column named col1 cannot be found.
Parameter name: columnName
When I access it by numeric index all ok. But when by Column name it returns this error. Where are I am wrong?
-- modified at 15:33 Sunday 26th March, 2006
|
|
|
|
|
I am trying to debug a Windows Service written in VS 2005 in VS 2005. I installed the service, it works fine, now I just wanna step through the code. I started the service, went into VS 2005 opened the project went to Debug selected Attach to process and in the list I have to entries for my service: one of type T-SQL code, Managed code and one that is Managed . I selected the T-SQL code, Managed code hit the Attach button and I get the Unable to attach to the process. A debugger is already attached. error message. Am I missing something here?
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
It's not what you are looking for, but for Windows services what I do is create a console application that spawns a secondary thread and calls the OnStart method of the service. This way I can debug it much more easily.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
An even simpler method I found is adding Debugger.Launch() in the OnStart method of the service. This will launch a dialog to select the debugger. Pretty neat.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
How can i check if a database exists on an instance of SQL Server?
|
|
|
|
|
Open a connection to the master database on the SQL Server and using the following SQL (or similar)
SELECT name FROM sysdatabases This will return the names of all the databases on the SQL Server.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Hi there,
Well, I am facing some problems while loading an assembly dynamically from a subdirectory located in ApplicationBase. The code works just fine when this dll is located in the application directory but when I tried to load it from one of the application's subdirectory it is not working even when I tried following options:
First, I created a "test" subdirectory for my test.dll(As far as my understanding of deploying a private assembly goes I believe runtime locates dll in application directory then it looks for a subdirectory having dll's name e.g. temp in this case and finally it goes to GAC.)
Second, I get following error log from fusion
LOG: Private path hint found in configuration file: test.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
where test is the subdirectory I am putting this dll.
I have included in app.config but it doesn't seem to work.
Also I have tried to use tags and made this assembly strong named and unfortunately that didn't work either.
Additionally, I have tried both LoadFrom() and Load() methods but no help.
As far as my understanding goes I think I do not need to create a strong named assembly when I am using probing element in config.
Any suggestions would be greatly appreciated.
Thanks in advance.
-Subby
|
|
|
|
|
How can i make a FlateStyle.System Button show image near the button text?
Mohamad Gamal
|
|
|
|
|
The following links should be helpful to u.
http://www.dotnet247.com/247reference/msgs/42/212760.aspx
http://www.dotnet247.com/247reference/a.aspx?u=http://www.codeproject.com/cs/miscctrl/xp-style_button.asp
Regards,
Pramod
|
|
|
|
|
Thanks for your help but,
this link show a XP Style button witch give a button a stable style and not changed with the windows button style,
i am looking for a button with image and with the currunt user windows style.
Mohamad Gamal
|
|
|
|
|
hi all
I looking for a code in C# that
chake 2 files in c# or more.
chake if bean any copy between them or not
tanks alot
it's very importent to me!
|
|
|
|
|
I hope to carry out the Cell as ( MoneyCell)
DEMO
DEMO
How to do it with the DataGridViewCell?
Thanks.
-- modified at 6:15 Monday 17th April, 2006
|
|
|
|
|
Hi,
I'm trying to typecast a class that I load from a dll. This class is using a certain interface and I'd like to type-cast it into the same interface (see code).
I should also point out that the main class and the class that I'm trying to load into it are in two seperate projects (and namespaces).
But my problem is that when I run this I get the error:
"Unable to cast object 'Class1' to type 'IPlugin'."
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
class Class1 : IPlugin<br />
{<br />
public Class1() { }<br />
<br />
public String getInfo()<br />
{<br />
return "weeee";<br />
}<br />
<br />
}<br />
<br />
public interface IPlugin<br />
{<br />
String getInfo();<br />
}<br />
<br />
<br />
namespace DLL_LoadTest<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Assembly assembly = Assembly.LoadFrom(@"C:\Test\ClassLibrary1\bin\Debug\ClassLibrary1.dll");<br />
<br />
IPlugin plugin = null;<br />
plugin = (IPlugin)assembly.CreateInstance("Class1");<br />
}<br />
}<br />
}<br />
please help!
thanks,
HHG
-- modified at 10:21 Sunday 26th March, 2006
|
|
|
|
|
Do you cast it into the actual interface that the class uses, or have you just created an interface with the same name in your code?
---
b { font-weight: normal; }
|
|
|
|
|
Uhm.. yes .. well.. yeah, I was using two interfaces (one in each project) both with the same name.
Once I referenced to the other one everything started to work
Thanks for the help, I just love it when the solution is too simple :P
|
|
|
|
|
If I was writing a program and wanted to trap 'all' the errors in the program, would I have put try-catch blocks 'everywhere' in my code? Is that the only way to do it? It's better to gracefully exit the program displaying the reason for the crash to the user, rather than having a .Net framework message popup with some mumbo jumbo.
|
|
|
|
|
Put try-catch blocks around the code where you anticipate errors, like database calls, file handling, and other stuff that rely on external resources. Catch the Application.TreadException exception to handle any unforseen errors.
---
b { font-weight: normal; }
|
|
|
|
|
I've never used Application.ThreadException . How do I use it? Any quickie examples?
|
|
|
|
|
Hello,
I am using C# to call a javascript function.
The original c# code is :
private const string AttachContextMenu = "return __showContextMenu({0});"; //this is the string which represents the javascript function
//then I use string.format on the string constant
public string GetMenuReference()
{
return String.Format(AttachContextMenu, Controls[0].ClientID);
}
//finally, the javascript is called upon the 'oncontextmenu' event
ctl1.Attributes["oncontextmenu"] = GetMenuReference();
But when I changed the GetMenuReference() method to the following,
return String.Format("return _showContextMenu({0});",Controls[0].ClientID);
the javascript function does not work anymore!! All I did was to replace the const variable with the actual string itself. How come it doesnt work already?
|
|
|
|
|
Because you are calling a function that does not exist. Replace "_showContextMenu" with "__showContextMenu".
---
b { font-weight: normal; }
|
|
|
|