|
|
JoeRip wrote: (I can't figure out how to show the angle braces).
Try reading the page you use to post the code into. There is a check box that says something about ignoring HTML or something.
led mike
|
|
|
|
|
I'm following the code here http://www.developerfusion.co.uk/show/4071/1/ to check Verizon email.
On this page the code is started http://www.developerfusion.co.uk/show/4071/7/. I set the server to 'incoming.verizon.net', and my username and password.
When I run it, I get the error "An existing connection was forcibly closed by the remote host".
I'm not sure what this means, or what I'm doing wrong. I checked the code, and it's all entered as exactly as in the article.
Anyone know what this message means?
Everything Makes Sense In Someones Mind
|
|
|
|
|
Just a tip...if you get an error, copy the error message and Google it. There are many chances that you will find the answer there itself without waiting for someone's comment here.
Like this[^]
KMAROIS wrote: I'm not sure what this means, or what I'm doing wrong. I checked the code, and it's all entered as exactly as in the article.
Well, in your case I believe either your username or password is incorrect.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I am not sure what I am missing, pls point me out
public class X{
private MyPage mypage;
public MyPage MainPage { get { return mypage;} set { mypage;= value; } }
ArrayList listedApplication = new ArrayList();
listedApplication.Add("A");
listedApplication.Add("B");
listedApplication.Add("C");
}
I need to assign this Array list to a property
class MyPage
{
private ArrayList applicationList = new ArrayList();
public ArrayList ApplicationList { get { return applicationList; } set { applicationList = value; } }
}
I tried assigning using
MyPage.ApplicationList = listedApplication ;
I get a NullReferenceException, asking me to use new. i tried using
public class X{
private MyPage mypage;
public MyPage MainPage { get { return mypage;} set { mypage;= value; } }
ArrayList listedApplication = new ArrayList();
listedApplication.Add("A");
listedApplication.Add("B");
listedApplication.Add("C");
MyPage.ApplicationList.Add(new ArrayList(listedApplication)) ;
}
but still get the same error, pls help
|
|
|
|
|
There is an incorrect semicolon in your setters. I do not know if that is your problem however.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
maybe you need
public class X{
private MyPage mypage = new MyPage();
... ?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
AnilUnni wrote: I tried assigning using
MyPage.ApplicationList = listedApplication ;
I get a NullReferenceException, asking me to use new.
You can't possibly have gotten a NullReferenceException with that code. It's a runtime error, and you can't run the code as it doesn't even compile.
MyPage is a class, and ApplicationList is not a static member of the class, so you can't access it that way.
AnilUnni wrote: MyPage.ApplicationList.Add(new ArrayList(listedApplication)) ;
Using "new ArrayList(listedApplication)" would only create a new ArrayList that is a copy of the first ArrayList, so that doesn't serve any purpose in your case. Adding the ArrayList to the ApplicationList property would create an ArrayList containing an ArrayList, which would work so far, but is surely not what you intended.
The problem is still that you are accessing the ApplicationList property as if it was a static member of the MyPage class.
Unless you are stuck with framework 1.x you should not use the ArrayList class at all. Use a type safe generic list instead, like List<string>.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi
i am working on a project that neede to use multi threading
in a method i use Monitor.Enter(Object) for define a critical area.
now if few thread wants to execute the method , monitor.Enter avoid to run Synchronize the method by all thread at the same time, so few threads will be on wait state.
now my problem is may be user wants to cancell the execution of a thread that is on wait state
how can i kill the thread.???
if i call Thread.CurrentThread..Interrupt() below error appears:
"cannot kill a thread that was in wait state" this is not complete error, this is just shortest of error.
thank you
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
The thread that currently owns the lock should use some mechanism
to indicate a "cancelled" state and then release the lock.
After acquiring a lock, waiting threads should first look at the
cancelled state before proceeding.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks alot mark but whats that mechanism?
i tray alot but cannot find a solution.
please tell me completely
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Add a boolean property to the class perhaps?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You might try to use Monitor.TryEnter . This does not block, however you have to do this in a loop until you finally get the lock. This is called polling/busy waiting and can cost some CPU cycles, but maybe it works better in your case.
while(!Monitor.TryEnter(obj) || !shouldStop)
{
Thread.Sleep(1000);
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I am not sure about the article but even MSDN says that you cannot take full control of a thread. the mostr you can do is to make it wait. I am not sure about article but I remember these things.
Hope it helps.
"If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be 'meetings'." - Dave Barry
|
|
|
|
|
hi friends?
my question is just the title:
can we retrieve source code of an exe file that compiled with c#.net 2005????
i am working on a project that contain a several code lines that keep few top secure codes.
i affraid that someone can retrieve the code of my application by exe file and got the top secure code lines.
if this subject is possible, please tell me how it is happened? and if it is not impossible please tell me a solution for more safety in my work.
thank you.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Hi, there are several tools doing this. Personally I prefer Reflector[^]
Mika
|
|
|
|
|
1. google "obfuscator". There are some built in obfuscators in VS 2008, and some commercially available external ones. These make it so tools like "Reflector" can't easily decode your exe
2. google ".net secure strings". .NET provides some ways to store secret values in your code so they can't be decoded at all (theoretically).
|
|
|
|
|
I have a C# class with an event. I have added a handler for this event in a VB.Net windows form. However, within the C# class when I check if any handlers are created it returns null and thus the handler is not called. But I am creating an instance of the class and adding a handler to its event.
Any ideas why the event is now getting wired? Here is some code:
public delegate void ValidityChanged(object sender, EventArgs e);
protected void RaiseEvent(ValidityChanged handler, EventArgs e)
{
if (handler != null)
{
handler(this, EventArgs.Empty);
}
}
Here is the handler:
AddHandler Me._selectedSizeRun.Validated, AddressOf SizeRun_Validated
|
|
|
|
|
CodingYoshi wrote: Any ideas why the event is now getting wired?
Since you did not post any code, my guess is you did something wrong. Does that help?
led mike
|
|
|
|
|
The following segment may or may not be syntactically correct, but the overall structure is accurate. Items marked with question marks I am not for certain if they are needed.
include the following in the custom control
public delegate void ValidityChangedHandler(object sender, EventArgs e);
public ?event? ValidityChangedHandler ValidityChanged;
public void OnValidityChanged(object sender, EventArgs e)
{
if(ValidityChanged!=null)
raise event ValidityChanged;
}
when including in parent control:
this.customControl.ValidityChanged+=new ValidityChangedHandler(newMethod);
public void newMethod(object sender, EventArgs e)
{
}
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I have all that but for some reason when checking for a handler it returns null. Here is the complete code for this portion of the C# class responsible for raising the event:
public delegate void ValidityChanged(object sender, EventArgs e);
public event ValidityChanged Validated;
public event ValidityChanged Invalidated;
Within a method when the object changes I call this:
OnValidated(EventArgs.Empty);
public void OnValidated(EventArgs e)
{
RaiseEvent(Validated, e);
}
protected void RaiseEvent(ValidityChanged handler, EventArgs e)
{
if (handler != null) // this is false although I create a handler below in the vb code
{
handler(this, EventArgs.Empty);
}
}
This is the vb.net code for handling:
Imagine the above C# class's name is SizeRun
Dim run as SizeRun = new SizeRun()
AddHandler run.Validated, AddressOf SizeRun_Validated
Private Sub SizeRun_Validated(ByVal sender As System.Object, ByVal e As System.EventArgs)
' handle the event
End Sub
|
|
|
|
|
I can't see anything wrong with your code.
This (all C#) is basically your code put into a simple console app and it works perfectly!
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SizeRun run = new SizeRun();
run.Validated+= new ValidityChanged(SizeRun_Validated);
run.TestEvent();
Console.ReadKey();
}
static void SizeRun_Validated(object sender, EventArgs e)
{
Console.WriteLine("Validated Event Fired!");
}
}
public delegate void ValidityChanged(object sender, EventArgs e);
public class SizeRun
{
public void TestEvent()
{
OnValidated(EventArgs.Empty);
}
public event ValidityChanged Validated;
public void OnValidated(EventArgs e)
{
RaiseEvent(Validated, e);
}
protected void RaiseEvent(ValidityChanged handler, EventArgs e)
{
if (handler != null)
{
handler(this, EventArgs.Empty);
}
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
CodingYoshi wrote: Dim run as SizeRun = new SizeRun()
AddHandler run.Validated, AddressOf SizeRun_Validated
The code you posted does not show the scope of run , nor does it show the OnValidated event being fired. There could be a disconnect between them.
led mike
|
|
|
|
|
Sco
led mike wrote: The code you posted does not show the scope of run
The scope of SizeRun is public else it will give me compilation errors.
led mike wrote: nor does it show the OnValidated event being fired
The method RaiseEvent() fires the event.
|
|
|
|
|
CodingYoshi wrote: The scope of SizeRun is public else it will give me compilation errors.
public is an Access Modifier which determines the Visibility[^] of the variable and is not the same thing as Scope[^]
So we still don't know the Scope of the variable
CodingYoshi wrote: The method RaiseEvent() fires the event.
The method RaiseEvent is called from OnValidated which appears to be an event handler
CodingYoshi wrote: public void OnValidated(EventArgs e)
{
RaiseEvent(Validated, e);
}
The code you posted does not show OnValidated being called or if it is a registered event handler we are not seeing where the event is being fired. Therefore it is possible that your VB code is trigging the event for a different instance of SizeRun class than the one that is used to register the event handler. This is the potential disconnect that I am talking about.
led mike
|
|
|
|