|
Thank you both.I made some mistakes.Its OK now.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi
I am facing a problem when darging and droping a user control. How can i Drag and Drop a user control physically. that is when draging and droping the control must go from one place to the other
|
|
|
|
|
Is there a way to count the number of subscriptions to a given event? We all know about the += operator to add a new subscription to an event and the -= to remove one. So, can you count the number of subscriptions, for example, a click event of a menu item:
this.mnuFileOpen.Click += new System.EventHandler(this.mnuFileOpen_Click1);
this.mnuFileOpen.Click += new System.EventHandler(this.mnuFileOpen_Click2);
this.mnuFileOpen.Click += new System.EventHandler(this.mnuFileOpen_Click3);
I would like something like this (I know this is not valid):
int nClickCount = this.mnuFileOpen.Click.Count;
or
int nClickCount = CountSubscriptions(this.mnuFileOpen.Click);
nClickCount would be 3.
Thanks in advance
Andy
|
|
|
|
|
In fact, you are using a multicast delegate instead of a single cast delegate (System.MulticastDelegate instead of System.Delegate).
The System.MulticastDelegate API provides what you need.
Namely, GetInvocationList(); returns the Delegate[] array.
How low can you go ? (MS rant)
|
|
|
|
|
OK. So, from the example I gave, what would I need to do exactly to get the count? I'm a bit unsure.
Thanks again
Andy
|
|
|
|
|
More info on delegate type is needed to provide full source code.
I guess this code will be helpful :
class App {
delegate String GetStatus();
static void Main() {
GetStatus getStatus = null;
getStatus += new GetStatus(new Light().SwitchPosition);
getStatus += new GetStatus(new Fan().Speed);
getStatus += new GetStatus(new Speaker().Volume);
Console.WriteLine(GetComponentStatusReport(getStatus));
}
static String GetComponentStatusReport(GetStatus status) {
if (status == null) return null;
StringBuilder report = new StringBuilder();
Delegate[] arrayOfDelegates = status.GetInvocationList();
foreach (GetStatus getStatus in arrayOfDelegates) {
try {
report.Append(getStatus() + "\r\n\r\n");
}
catch (Exception e) {
Object component = getStatus.Target;
report.Append("Failed to get status from " +
((component == null) ? "" : component.GetType() + ".") +
getStatus.Method.Name +
"\r\n Error: " + e.Message + "\r\n\r\n");
}
}
return report.ToString();
}
}
How low can you go ? (MS rant)
|
|
|
|
|
I have a simple c# component which actually read the Excel Spreedsheet and store the contain into an array.
I'm referencing the Microsoft Excel 9.0 Object Library in my C# componenet.
It work OK when i using the C# sample program to call the component but it not able to read the excel file when i using the ASP.NET.
The error message "Access is denied" is show when i using the ASP.NET to call the component.
I have try to open and read the same excel file only using ASP.NET by using SELECT * FROM [SHEET1] and able to read the Spreedsheet contains.
It open and read the file successfully. When i bind the dataSet from the Excel spreadsheet to the DataGrid, it show all the contains in the DataGrid.
But it not show the complete DataSet contain when i try to print the dataset contain in xml format using
Response.write(ds.getxml()).
Have anyone of you have experience this problem before? please advice. Thanks.
Regard
LSL
|
|
|
|
|
mee wrote:
The error message "Access is denied" is show when i using the ASP.NET to call the component.
ASP.NET runs in its own user ID ("ASPNET"), so that user must be given permission to access your file.
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
Hi Paul ,
Thanks for your reply, i have already given permission to ASPNET user , IIS user [IUSR_Machinename] and everyone with Full control on the excel file.
The error on browser actually highligt the following line (this line actualy program in the C# component).
ExcelObj = new Excel.Application();
Is it possible because ASPNET user do not have access to any of the excel library file . Anyway i also try to set the EXCEL9.OLB permission to the ASPNET user. It still giving the same error.
Regards
LSL
|
|
|
|
|
I have a C# application that calls functions on a MFC COM dll. I can easily debug my C# code, but I can't seem to be able to step into the MFC code. Did anybody try this?
Thanks
|
|
|
|
|
Have you tried to add a DebugBreak() statement in your MFC code. Actually when the .NET virtual machine leaves his context to execute unsafe code, I believe it is up to you to manage to catch up.
How low can you go ? (MS rant)
|
|
|
|
|
True, it does start VC6, but it throws me in disassembly. I can't actually step into the MFC code.
|
|
|
|
|
Are you using the debug version of the COM DLL?
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
Anonymous wrote:
True, it does start VC6, but it throws me in disassembly.
That's what DebugBreak() usually does, even in a simple WIN32 only environment. Use the debugger callstack.
How low can you go ? (MS rant)
|
|
|
|
|
Have you tried to turn on the option to debug unmanged DLLs? Select your project in Solution Explorer. Right-click, select Properties, select Common Configuration Properties, Debugging, then Enable Unmanaged Debugging. The default is False. Set it to True.
Gaul C. Ihenacho
|
|
|
|
|
Is there a way that I compile a C# project as unmanaged?
Thanks
|
|
|
|
|
C# by its very nature is always managed. It can use unmanaged code through the Interop Services. If you need to do this, you could stub unmanaged code through a C# implemented Facade Design Pattern[^]
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Is this possible? I'm using Visual Studio Enterprise Edition and I do have Visio 2002 installed here as well. I know how to use UML to create the diagrams, I just don't know where the code generation feature is...
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
menu->
"UML"
then
"CODE"
then
->"Generate"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hello
i need help on how to convert xsl:fo or xml document to pdf using c sharp
i BADLY need that.
Asim
|
|
|
|
|
|
Try changing the procedure to:
CREATE PROCEDURE Get
@ID PK_SMALLINT = NULL
Select * from Table
where ( (@ID IS NULL) or (ID = @ID) )
|
|
|
|
|
I try to subclass a window using WinAPI but I get a problem on the function declaration in DLLImport. Please help me if you can. Thanks anyway.
|
|
|
|
|
MSFT Eric Gunnerson article on win32 interop[^].
You should also post the exact function names you are trying to interop.
How low can you go ? (MS rant)
|
|
|
|
|
Hi there,
here is my problem: i need a certain class to be used in a webmethod an a client. In order to do so i made a little library called ChatLib containing the class ChatMsg. Both, webservice and client, have the line "using Chatlib;", but the proxy (which is generated by the Visual Studio) seems to do something different.
The Compiler tells me that he is not able to convert 'chatclient02.localhost.ChatMsg' to 'ChatLib.ChatMsg' (referring to a line in the windows form, where i want to start the webmethod).
(in german: "Implizite Konvertierung des Typs 'chatclient02.localhost.ChatMsg' zu 'ChatLib.ChatMsg' nicht möglich.")
exchanging the line "using Chatlib;" by "using chatclient02.localhost;" in the client makes the compiler happy but the program does not run properly which means that there are system exceptions thrown.
i would be grateful for every answer especially those, that support the usage of Visual Studio.NET
PS: I already posted this one on another board, which was probably the wrong address. If this is true for this board, too, i might be happy getting an answer such as: "this is the wrong board, try this: ...".
|
|
|
|