|
need to supply the version number of my .exe in a Help/About dialog... tried using "Assembly.GetExecutingAssembly" static function which gives the version number in a string along with some other attributes, but I'm sure there's a better way of obtaining your own version number...???
thanks for any help...
|
|
|
|
|
Assembly.GetExecutingAssembly().GetName().Version
<a TITLE="See my user info" href=http:
|
|
|
|
|
hi there,
I am a new kid in the block . Today, I have tried my very first program in ASP.NET using C# language. Let me try explaining what am i doing here. I have created 2 text boxes and one text area in a webform and entering values in those fields and trying to display those values in the same web page. But it is displaying an error on the internet explorer.
You can see the error discription underneath
Compiler Error Message: CS0246: The type or namespace name 'spanComment' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 4:
Line 5: void Submitbtn_click(Object sender, EventArgs e){
Line 6: spanComment.InnerHtml = "Here are the details we received:<BR/><BR/>" +
Line 7: "First Name : " + firstname.text + "</br>" +
Line 8: "Last Name : " + lastname.text + "</br>" +
Source File: C:\Inetpub\wwwroot\asp.net\submitreceivecomments.aspx Line: 6
I am very bad in explaining things but i tried my best explaining where am i strucking at . Please help me solving this .
thanks in advance.
Dev
|
|
|
|
|
The compiler is barking at you because it can't determine what type spanComment is. It is probably because you are missing a "using" directive or a reference.
You'll need to determine what class you've derived spanComment from and ensure you have the proper using directive in your code module. You also need to make sure you've set a reference to the proper component/namespace via Project->Add Reference.
Good Luck!
Paul Lyons, CCPL Certified Code Project Lurker What a long, strange trip it's been.
|
|
|
|
|
hey thanks paul... i got it i forgot to to declare span id. hope i said it right. later on i have included
|
|
|
|
|
Is it possible for a class to inherit from an interface and abstract class? For example:
interface iMyInterface
{
void Method1();
}
abstract class MyAbstract
{
------------some code
}
Can I have a class that will inherit from both iMinterface and MyAbstract?
Thanks.
|
|
|
|
|
*A C# class can inherit from only one base class, but can implement any # of interfaces.
*List the base class first, followed by any interfaces you want to implement.
class TheClass : MyAbstract, IMyInterface
{
}
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hi All !
I have a main Form ( Form1 ) , and then create a new Form ( Form2 ). OK , now on Form1 I put Button0, Button11, Button12 and Edit1 . On Form2 : Button21, Button22 and Edit2 .
How to do if :
- When I click on Button0 ( Form1 ) then Form2 Appears . Typed something in Edit1 , and click on Button11 then all things in Edit1 will be copied to Edit2 ( on Form2 ) . If typed something in Edit2 and then Click on Button12 then Allthing in Edit2 will be copied to Edit1 . and the analogous process : if typed something in Edit2 and Click on Button21 then allthing in edit2 will be copied to Edit1 , if Click on Button22 then allthing in Edit1 will be copied to Edit2!
|
|
|
|
|
If you create second form you can access to its functions and memebers:
Form2 frm=new Form2();
To show this form use frm.Show()
If you want to call methods of first form you need to store reference to first form in member of second form.
class Form2 : Form {
Form1 frmRef;
}
Add this below code that creates second form: frm.refForm=this;
i'm only pointer to myself
|
|
|
|
|
Ok ! Super ! Super !
Thank you very much , it works well as expected !
|
|
|
|
|
I've seen examples like this a number of times, but why not just use the owner property of the child form when you create it? - this would save creating a new form object in each child form, especially when it has the right property sitting there waiting to be used.
you can access it by
Form2 frm=new Form2();
frm.Owner = this;
then in the child form you can access this by
((Form1)Owner).publicproperty = value;
a bit more typing but keeps overheads down I would assume.
|
|
|
|
|
I have a strange problem related to ever rising memory in the GC heaps. When
I run my service, memory is continually allocated during a test cycle.
However if I simply change the services startup routine to instead just wait
showing a messagebox (instead of adding the service) and let the other
threads carry on their work I get a nice zig-zag line as expected in perfmon
showing #Bytes in all Heaps which always stays under #Total committed
Bytes. The graph for the service version just increases upward for both
counters. What could be happening?
I understand that the GC only collects memory if it has to, and is only does
this during further allocations but I want to prevent my service claim more
resources than is needs to run preventing other NON .NET application being
starved of RAM.
|
|
|
|
|
solidstore wrote:
I understand that the GC only collects memory if it has to, and is only does
this during further allocations but I want to prevent my service claim more
resources than is needs to run preventing other NON .NET application being
starved of RAM.
What memory intense objects are you creating? Perhaps implementing them as a static object will not require it to be created everytime, and does it need to be created for every call or does the object prefer to stay "persistant" across web service calls?
You will have to supply some more info if you want someone to give you a better answer.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Basically I have a Windows Service which is hosting some Remotable objects. These objects are also registered with COM.
Our test client in an ASP code which creates the COM objects. This activate the real .NET object inside my C# service. Everything work fine, except that memory allocs continue endlessly.
In desperation I changed the service to run as a standard process whilst I was debugging. Now memory is being correctly garbage collected. I'm using the perfmon counter to view the zig-zag profile.
Memory only increase when the code is run as a Service. I just have to replace the ServiceBase.Run method call with a long Sleep. To make my test run behave VERY differently.
The objects I'm creating for each test call are very small & stateless. They return a small string ("foo") from they only method call.
The ASP code sets the object to Nothing after the call. I'm assuming releasing the COM object, releases the CCW, which release the remote server object.
|
|
|
|
|
solidstore wrote:
Memory only increase when the code is run as a Service. I just have to replace the ServiceBase.Run method call with a long Sleep. To make my test run behave VERY differently.
The objects I'm creating for each test call are very small & stateless. They return a small string ("foo") from they only method call.
From what you're saying, it seems to be a bug in the .NET framework. Your ASP page hasn't changed, only the server is changing, but the components are no being released anymore. Are they MarshalByValue or MarshalByRef objects?
Depending on what you're doing, as a workaround, I suggest you to derive your classes from ServicedComponent and run them from inside a COM+ application, and export the application proxy, so the ASP page could call your components.
I use it all the time and it's very stable.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
My remote objects derive from MarshalByRefObject and their custom COM interface. I read in a newsgroup somewhere that if you derive from this class you must call System.Runtime.Remoting.RemotingServices.Disconnect. But from where?
How simple is hosting inside COM+? I'm meant to ship this week!
Could anyone else confirm this is a bug in .NET? You only need a small application to test this I guess.
|
|
|
|
|
solidstore wrote:
How simple is hosting inside COM+? I'm meant to ship this week!
It will take you only a few minutes. For trivial objects, it's just a matter of deriving from ServicedComponent (which is indeed derived from MarshalByRefObject), put some attributes on the assembly describing the package name, and some simple configurations, and then, running regasm to put your assembly under COM+.
And you'll need to remove all your service code, COM+ will take care of this for you.
solidstore wrote:
Could anyone else confirm this is a bug in .NET? You only need a small application to test this I guess.
This raises me another (I know, obvious) question: are you with 1.1 framework? 1.0 with all SP applied?
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
I'm using 1.0 framework with SP2. With less than a week to go v1.1 seems a bit risky + we have lots of other apps on v1.0 that need to ship together. I'm developing & testing on XP pro but we deploy onto Win2K advanced servers. Fully patched & serviced packed in both cases.
|
|
|
|
|
I'm using 1.0 framework with SP2. With less than a week to go v1.1 seems a bit risky + we have lots of other apps on v1.0 that need to ship together. I'm developing & testing on XP pro but we deploy onto Win2K advanced servers. Fully patched & serviced packed in both cases.
I've also made an interesting discovery:
I've downloaded the SciTech memory profiler which I've attached to the Service. Things continue to leak as usually during the test, however after I create the first snapshot, it seems to start garbage collecting correctly!!!! I dont know what the profiler does but you can see that is makes some forced GCs which kick things into action. I've tried to do this myself in code by forcing collection but it didnt work. What could be causing things to suddenly work when the profiler first does something?
|
|
|
|
|
solidstore wrote:
I've downloaded the SciTech memory profiler which I've attached to the Service. Things continue to leak as usually during the test, however after I create the first snapshot, it seems to start garbage collecting correctly!!!! I dont know what the profiler does but you can see that is makes some forced GCs which kick things into action. I've tried to do this myself in code by forcing collection but it didnt work. What could be causing things to suddenly work when the profiler first does something?
Forcing collection doesn't work? Strange. It seems that you have some form of dangling pointers. You've said you are mixing remoting + COM. Can you isolate one of them, like, creating a "pure" remoting client and a "pure" COM client, to see where is the problem, or if the problem comes with mixing them?
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
good idea! do you mean create a C# exe to test the Remoting by creating the objects natively? And create another C++ client to create the COM objects but without setting up the remoting configuration?
Other tests just in:
I've just tried make my service run under my local administrator account (instead of SYSTEM) and the memory performance counters appear normal (although my process no longer show up in the perfmon list - I'm having to use _Global_).
Could the user account being used affect GC?
Why has my process/service disappeared from perfmon now I've changed the user account?
|
|
|
|
|
|
Also is Remoting and COM Interop OK with the same object? Or should I create one object thats exposed to COM which internally calls my remote component?
|
|
|
|
|
Are you using COM objects in your service, like ADO recordsets?
They can be a big source for memory leaks, because all the GC can see is the managed allocated memory, which is small, basically a pointer to a small wrapper. But, on the side of the COM object, it may be taking several MB of RAM.
So, to assure a COM object is correctly garbage collected, you need to call System.Runtime.Interop.Marshal.ReleaseComObject on a loop until it returns 0.
Another common source for memory leaks under a GC environment is forgetting to call Dispose on the IDisposable objects.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
see reply to leppie above - many thanks
|
|
|
|