|
One part of the article you linked talks about passing information between forms using properties, like the example you provided, and towards the end the article provides examples of using delegates and events to pass info between forms. My suggestion is that you use delegates and events, instead of properties, and raise the event in the child form as the child is closing (in the FormClosing event) so that the information gets returned to the parent form at that time, instead of being lost on the close. Or, as an alternative, you could raise the event whenever the text is actually changed, and make the changes to the database each time the text is changed.
If you did try the delegates/events example, and had problems with that, please describe what problem/error you were receiving.
|
|
|
|
|
Hi,
I call a web service with relevant parameters as follows:
MyNameSpace.MyWebService.MyMethod ws;
ws.ExecuteProcess(strXML, 0);
This is the result of the web service which I call after passing the relevant parameters as shown above
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org//ServiceExecuteProcess"><ProcessExecutionResults Process="AllData" Result="Success" OutputId="Success" Records="1" User="My User name" Name="install them all" ProcessItemId="22b1d5a9-8438-403f-83a6-fb6ce1b62036" /></string>
Now I would like to get back the Result="Success"
How do I modify the above code to get to the value "Success" ?
Thanks
|
|
|
|
|
Did you write the webservice? If so, use it correctly and return a class structure and not a XML string... Else use the XML Schema of the webservice to make XML deserializable classes and use the XmlSerializer.
|
|
|
|
|
I did not write the web service.I am not sure where to get the schema.
Can I not just somehow make it to assign the returned result into a string and then search for the word Result in that string ?
Thanks
|
|
|
|
|
arkiboys wrote: I did not write the web service.I am not sure where to get the schema.
You have my pity, personally I would hunt the author down and skin him/her alive!
arkiboys wrote: Can I not just somehow make it to assign the returned result into a string and then search for the word Result in that string ?
Load it into an XmlDocument then use SelectSingleNode() .
|
|
|
|
|
This is what I have at present .
ws.ExecuteProcess(strXML, 0)
Do you mean change it to this?
XmlDocument xmlDoc = ws.ExecuteProcess(strXML, 0)
Thanks
|
|
|
|
|
Could you not just import the WebService definition into your application using Add web reference or Add service reference in VS 2008? You'll then get access to the webservice proxy.
|
|
|
|
|
Yes, I have added a reference to the web service and it works.
BUT, now I would like to get access to the xml it returns
|
|
|
|
|
arkiboys wrote: BUT, now I would like to get access to the xml it returns
Why? I'm unclear as to why you would want to do this, because you have got the results back put into a valid context.
|
|
|
|
|
I think he is dealing with those pass an xml string, get an xml string type webservices...
|
|
|
|
|
When I browse to the web service .asmx and manually place the parameters in the textboxes(Where parameters are required for testing) then click on the invokle button, then I get the result as xml. In that xml there is something called Result="Success" and this is what I would like to pull out.
Not sure how to do this though.
Thanks
|
|
|
|
|
I solved it.
The trick was to make sure the DefaultCredential is used.
Thanks.
|
|
|
|
|
But that's calling the asmx directly. If you use the proxy then you don't need to do this.
|
|
|
|
|
Hi all. I just got assigned a project that involves me interfacing with a scanner. Does anyone know how to do this using c#. I've been reading up on it and there are ways of doing it in c++ using TWAIN but I haven't found a way of doing it in c#. Does anyone know how
Thanks
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Stephen Lintott wrote: I've been reading up on it and there are ways of doing it in c++ using TWAIN but I haven't found a way of doing it in c#. Does anyone know how
Exactly the same. There is an article on CP that helped me when I needed to interface with a scanner. Have fun with the TWAIN spec...
|
|
|
|
|
Thanks
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Hi friends
I have a raw bytes data array. I send these bytes using socket send command, with out using encoding. But i am receiving junk data in other side. How can i solve this problem
thanks in advance
-RisKhan-
|
|
|
|
|
With the debugger.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi Guys,
I have a quick question. I googled for this but can't get a satisfactory answer. I need to know how to TrimEnd a specified number of characters. i.e I have a value like this 00000000123450000000 . I need to trim the last six zero's off the value. Now, I have written the below which removes all 7 zero's whereas I only want to remove the last 6 zero's.
char[] myChar = { '0' };
string cls = imp.Cls_Units_1.TrimEnd(myChar);
The above piece of code removes all trailing zeros but I need only remove the last six zero's. Does anybody know how I can get this done?
Cheers
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Have you thought of a for loop
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Not sure how a for loop is going to help here as the TrimEnd method itself removes any instances of the specified char[]. Can you show me what you mean please?
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Forget about the trimEnd method and do the following.
char [] chars = YourText.ToCharArray();
for (int i=startIndex;i<chars.length;i++)>
chars[i]='\0';
Where startIndex is equal to the first character you want to remove.
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Use the Substring method intead:
if (s.EndsWith("000000")) {
s = s.SubString(0, s.Length - 6);
} else {
' does not end with zeroes.
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa. How would you handle the following calculation? Just for interest sake.
I have an amount, which I can now correct get using the suggested method of SubString. I need to multiply that amount by 2.3 and then multiply the result by a further 9262.608696. Net amount I get and I do a Math.Round(netamnt, 2) to get the amount rounded to 2 decimal places. I would ideally want the netamnt without the decimal place. For example.
16436 * 2.3 * 9262.608696
The above gives me the following:
16436 * 2.3 = 37802.8
37802.8 * 9262.608696 = 350152544.0131488.
I would like to have my result as 35015254401.
What would be the best way of doing this?
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Just multiply the value by 100.0 and round to zero decimal places.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|