|
When you attach to an event handler, the class that has the event (Lets call it class A - the source), holds a reference to the class that handles it (Lets call it class B - the listner).
This means, that if that class A goes out of scope and is ready to be garbage collected the reference that A holds to class B is also out of scope, so nothing to worry about.
If on the other hand, class B goes out of scope, and you want it released, it won't be. A still has a reference to it, so B will never be released while A is still in scope.
In the case of things like forms and UI controls, you generally don't need to worry. The code handling the events is needed until the controls are finished with, then it's all released together.
The times you need to worry about it is when you have a class that you want to respond to events (The listener) for a little bit, and then get rid of the class while the class with the event (the source) stays alive for longer.
There's lots of different ways of handling this case. This article[^] will get you started if you do need to do it.
Simon
|
|
|
|
|
Thanks for reply.
Let's say I have a Form which uses BackGroundWorker for some work. Do I need to unregister BackGroundWorker events when I no longer need it? So that when the form is closed backgroundworker doesn't reference the form. Or will they get out of scope at the same time and there is no need for unregistering? Generally, if a Form stores an instance of class that provides an event do I need to unregister events?
Thanks again.
|
|
|
|
|
You have a form and a background worker. The background worker is the source, and I'm assuming the listener is the form. So the background worker has a reference to the form.
When the form is closed, the background worker goes out of scope, so it's reference to the form goes out of scope, so everything is fine.
(Background workers do require disposing though. If you don't dispose of them you will have other problems)
Generally, no, in these cases you are all right. Just watch out for when you have a source that you want to exist for longer than your listener.
Remember that the listener (in this case the form) cannot be released until after the source (the background worker) is released. In this case you are fine because you want to release both at the same time, so it will be ok.
Simon
|
|
|
|
|
Thanks again
|
|
|
|
|
I have a
WSDL and proxy class of webservice which have following link
https://webservices.innovativegateway.com/
IGSPaymentService/IGSPaymentService.asmx
but it is undiscovered, that is the reason that i am not able to conect it.
Thanks
sam
Web Developer
|
|
|
|
|
Unless they supplied you with a WSDL, you will probably have no luck. It seems WSDL publishing is turned off like it should be.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
|
thanks for you co operation
but problem is how to discover wsdl file.
i am sending you a link of Innovative wsdl and proxy class uploaded link.
http://rapidshare.com/files/154244309/Innovative.zip.html
thanks
sam
Web Developer
|
|
|
|
|
I am writing a program in that populates an Excel spreadsheet.
I know that it is not possible to have autoheight or autofit on merged
cells. I need the height of the row to expand to fit an undetermined amount
of text. I wonder if anyone has code to get around this problem. I need to
find a way to get around this problem and fast. Anyone found a way around it?
modified on Wednesday, October 15, 2008 5:00 AM
|
|
|
|
|
You really have you languages screwed up. Title C#, content VB.net, target VBA.
The cell will have a wrap text property which you will need to set.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
wrapped property for merged cell is set. still not showing the hidden part.
|
|
|
|
|
I have a site in which i have used i-frame
to open a site in which i have 2 I-frame
in those i-frames i am opening .aspx pages in which i have implemented validations.
When i open this site with the help of browser then all validators work fine but when i open this site in another site using iframe then it shows JavaScript error "Access Denied"
Site(A) .aspx Page
Iframe(place where I open site (B)
Site(B).aspx used two iframe
iframe 1
Iframe 2(open published .aspx pages)In this I have used Validaters
|
|
|
|
|
1. Read about cross-site scripting (and why it is not allowed).
2. Head off to the ASP.NET forum.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
hi lippie: but this is what client needed...so do u have any solution for that...or may be another method to do that.
|
|
|
|
|
Refer to point 2. You are in the wrong place. The ASP.NET forum is more appropriate.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
The following code is not compiling in .Net 1.1
[code]
This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <ocilib.h>
#using <mscorlib.dll>
using namespace System;
int _tmain(int argc, char *argv[])
{
OCI_Connection* cn;
OCI_Statement* st;
OCI_Resultset* rs;
int Counter = 0;
int ret;
FILE *TablesFile;
char *Database, *UserName, *UserPassword, *StartDate, *EndDate;
char Message[256] = "";
/* for (i=0; i<argc;> * {
* printf("%d %s\n", i, argv[i]);
* }
*/
Database = argv[1];
UserName = argv[2];
UserPassword = argv[3];
StartDate = argv[4];
EndDate = argv[5];
OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT);
cn = OCI_ConnectionCreate(Database, UserName, UserPassword, OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
sprintf(Message, "select MemNumber,Turnover from (select mem_number MemNumber,sum(trans_turnover) Turnover from members join transact on mem_number = trans_code where Trans_date between '%s' and '%s' and mem_barred = 0 group by mem_number order by turnover desc ) where rownum <=200", StartDate, EndDate);
// printf("%s\n",Message);
OCI_ExecuteStmt(st, Message);
// OCI_ExecuteStmt(st,"select MemNumber,Turnover from (select mem_number MemNumber,sum(trans_turnover) Turnover from members join transact on mem_number = trans_code where Trans_date between '01-Jan-2004' and '14-Oct-2008' and mem_barred = 0 group by mem_number order by turnover desc ) where rownum < 201");
rs = OCI_GetResultset(st);
// printf("OCI_GetResultset() returns rs = %x\n", rs);
TablesFile = fopen("Tables.html", "wt");
while (OCI_FetchNext(rs))
{
fprintf(TablesFile, "% 4d - %u\n", ++Counter, OCI_GetDouble(rs, 1));
}
ret = fclose(TablesFile);
OCI_Cleanup();
return EXIT_SUCCESS;
}
[/code]
.Net returns C1004: unexpected end of file found
and as hard as I look I cannot see a missing or additional brace.
|
|
|
|
|
It's an additional brace, and it is not C#. I suggest you try the C++ (or the Managed C++ one).
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hi,
I want to use Roman 10 cpi font for the Dot Matrix Printer for our crystal reports fast printing . But
because it is not a True Type Font dot net does not support it. How can I use it?
Rajesh
|
|
|
|
|
Hi all,
i got problem on session tracking using asp.net with c#.net.I need use session when user login into my website.
thank you.
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Could you tell us what your problem is?
|
|
|
|
|
here is my source code whn login button clicked..
can you check for me..
private void Button1_Click(object sender, System.EventArgs e)
{
switch (UserLogin(usertxtname.Text, usertxtpass.Text))
{
case 1:
Session.Abandon();
Login();
break;
case 2:
Label4.Text = "Incorrect Password";
break;
case 3:
Label4.Text = "Incorrect Username";
break;
}
}
public void Login()
{
FormsAuthenticationTicket objTicket = null;
HttpCookie objCookie = null;
string strReturnURL = null;
objTicket = new FormsAuthenticationTicket(1, usertxtname.Text, System.DateTime.Now, DateTime.Now.AddMinutes(60), false, Session.SessionID);
objCookie = new HttpCookie(".ASPXAUTH");
objCookie.Value = FormsAuthentication.Encrypt(objTicket);
Response.Cookies.Add(objCookie);
strReturnURL = Request.QueryString["ULogin.aspx"];
if (strReturnURL != null)
Response.Redirect("ULogin.aspx");
else
Response.Redirect("registration.aspx", false);
}
public int UserLogin(string strUsername, string strPassword)
{
int iReturnValue = 0;
string sql;
OdbcConnection myconn;
OdbcDataReader MyReader = null;
sql="Select count(*) as expr1 From login Where (pword='"+usertxtpass.Text+"')And(uname='"+usertxtname.Text+"')";
myconn= new OdbcConnection ("DSN=myodbc2;SERVER=localhost;DATABASE=misdb;UID=root;PORT=3306");
OdbcCommand cmd = new OdbcCommand(sql, myconn);
cmd.Parameters.Add("@username", strUsername);
cmd.Parameters.Add("@password", strPassword);
cmd.Parameters.Add("@ReturnValue", OdbcType.Int).Direction = ParameterDirection.ReturnValue;
myconn.Open();
MyReader=cmd.ExecuteReader();
MyReader.Read();
iReturnValue = System.Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value.ToString());myconn.Close();
return iReturnValue;
}
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Eduard asked what your PROBLEM is not for a code dump.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
hi
I want to create a website for seaching some details through websites using some particular keywords.Can you give me an idea for creating this.
Thanks in advance
Rasma
|
|
|
|
|
Member 4124915 wrote: Can you give me an idea for creating this.
Yes, ask it here[^]
While (true) { Human.isLearnable = true; }
|
|
|
|
|