|
The important piece of information missing is the actual type of the GetAgencyListCompleted event but your error message suggests that it is not an
EventHandler <PSSaleWS.GetAgencyListCompletedEventArgs>
If it is typed non generically as
public delegate void GetAgencyListCompletedEventHandler(object sender, PSSaleWS.GetAgencyListCompletedEventArgs Completed);
then the solution is to explicitly create a delegate of the correct type or let the compiler do it for you automatically.
either
ProntoWS.GetAgencyListCompleted += new GetAgencyListCompletedEventHandler(Proxy_AgencyInfoCompleted);
or
ProntoWS.GetAgencyListCompleted += Proxy_AgencyInfoCompleted;
If this doesn't solve your issue then please supply more information about the actual types involved.
Alan.
|
|
|
|
|
Hi Alan!
Thank you for your answer, I got rid of the implicit conversion problem with your approach but Proxy_AgencyInfoCompleted never fires up even I invoke the procedure after ProntoWS.GetAgencyListCompleted += new GetAgencyListCompletedEventHandler(Proxy_AgencyInfoCompleted); statement. Web service doesn't have specific asyncronous methods. Therefore I tried to call the method as follows bur Proxy_AgencyInfoCompleted didn't fire up. Do you have any idea where is the problem? Thank you very much.
ProntoWS.GetAgencyListCompleted += new GetAgencyListCompletedEventHandler(Proxy_AgencyInfoCompleted);
GetAgencyList = GetAgencyList = ProntoWS.GetAgencyList(Agent, User, Password, GetCityName, "TR");
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hello everyone,
I'm making a program that works on some lenovo laptops only, it makes use of Sensor.dll. I've used code below:
[DllImport("sensor.dll")]
private static extern void ShockproofGetAccelerometerData(ref APSReading accData);
I'm not sure how should I check if it exits on the system or not. I'm using lenovo laptop therefore program works fine on my system but If someone runs on different system then it should show a message "system doesn't support" or some other error message. Is it possible to check if certain dll is present in system before importing it??
Thank you
Shivam Kalra
|
|
|
|
|
Hi,
the easiest way is by putting your DLL calls (or at least the first one you are going to do) in a try block. The actual lookup of the DLL is postponed till it is actually called, and any error locating it, or its functions, is clearly turned into an exception.
You can find more about it under "Typical Exceptions" in my article here[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
You'll need to dynamically load the DLL at runtime so you can catch if it's not there.
Searching on "c# dynamically load unmanaged dll" yields examples, like this one...
Dynamically calling an unmanaged dll from .NET (C#)[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you guys.
I also found another way of doing it using Files.Exists method of .net.
|
|
|
|
|
That still lets you use DllImportAttribute??
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In my experience DllImport is not interested in the DLL at all (it is up to the programmer to make sure there eventually will be a DLL file and a function that matches with his prototype).
A C# app builds just fine without the DLL being present; and the calling code throws a DllNotFoundException at run-time whenever it doesn't find the DLL.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Good to know! Thanks Luc.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Cool thank you!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Iam using VS2010. I have 10 TextBoxes..
In TextBox1 I handled the event for GotFocus,LostFocus...like the following manner...
this.richTextBox1.GotFocus += new System.EventHandler(this.RichTextBox1_GotFocus);
this.richTextBox1.LostFocus += new System.EventHandler(this.RichTextBox1_LostFocus);
private void TextBox1_GotFocus(object sender, System.EventArgs e)
{
TextBox1.BackColor = Color.White;
}
private void TextBox1_LostFocus(object sender, System.EventArgs e)
{
TextBox1.BackColor = Color.LightSteelBlue;
} Like above I need to do all my Textboxes and I need to do the above codings, instead is it possible to have a common GotFocus,LostFocus to all Textboxes to do the above things?
Any Ideas?
Thanks & Regards
PARAMU
|
|
|
|
|
Sure, just wire the following handler to several textboxes:
private void tb_GotFocus(object sender, System.EventArgs e) {
TextBox tb=sender as TextBox;
if (tb!=null) tb.BackColor = Color.White;
}
You can do the wiring up at run-time, or using Visual Designer (click the event, choose an existing handler, after you added the above code, that is).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
It's perfectly possible to hook multiple items up to one event handler. The sender argument is there to identify the control that raised the event, so you can easily do the following in your handlers:
private void HandleLostFocus(object sender, EventArgs e)
{
TextBox control = sender as TextBox;
if (control == null) return;
control.BackColor = Color.LightSteelBlue;
}
|
|
|
|
|
THanks... I Get Clear.
|
|
|
|
|
|
c# - I have a problem with webbrowser control loading local images from a html page(also local).
It does not matter if its a saved page from internet, or made by me... the same problem persist.
BUT, from internet it load the page correctly,all the images are displayed.
What is the catch? I know that I find a solution long time ago, but now I cant find it again... I search everywhere but with no luck. Maybe some luck from you? Thanks.
|
|
|
|
|
Without seeing the code it is hard to tell, but check paths for a start.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I really don't think is for much help showing the code, but here it is:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(llistOfFileNames[listBox1.SelectedIndex].FullName);
webBrowser1.ScriptErrorsSuppressed = true;
webBrowser1.DocumentText = sr.ReadToEnd();
sr.Dispose();
}
modified on Sunday, May 22, 2011 10:44 AM
|
|
|
|
|
why don't you just provide a valid web page, something like:
object item=ListBox1.SelectedItem;
if (item!=null) webBrowser1.DocumentText="<html><body><img src='"+item+"'></body></html>";
BTW: SelectedIndexChanged will also fire when something gets deselected, possible causing unexpected values for SelectedIndex, SelectedItem, etc.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Sunday, May 22, 2011 11:38 AM
|
|
|
|
|
And if, for some reason, you don't have or don't want to use a local file, there is always this[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
merlinq12 wrote: I really don't think is for much help showing the code, but here it is:
Show the related code - in this case HTML maybe?
Are URLs correct?
Does the hosting process have permissions to access the local images?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
there are pages saved from internet... nothing fancy... they open alright in firefox browser(just to be sure their links are working alright).
|
|
|
|
|
The best thing to do is provide the *fully* qualified path (or url) for the file in question.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|