|
switch(time)
{
case "10:00":
case "11:20":
case "13:30":
break;
}
No multiple params in a switch case, fallthrough only allowed when no code is defined in that particular case.
|
|
|
|
|
Just to be clear on my end:
From your snippet, at 10:00 // Do Something will be performed?
Sorry, just want to make sure my Alzheimer's is not starting too early.
|
|
|
|
|
ffowler wrote: From your snippet, at 10:00 // Do Something will be performed?
Yes, no need to worry about failing memory yet
|
|
|
|
|
Wheeww. That's a relief.
Thank you very much for your prompt responses (and diagnosis).
|
|
|
|
|
Yes - because switch statements like this fall through to the next case. Note that they only work if there's nothing betweent the case statements. As soon as you introduce an operation, you have to use break;.
|
|
|
|
|
Howdey,
I have been digging into the issue of delegates and tried to implement http://www.colinmackay.net/Articles/PassingValuesBetweenFormsinNET/tabid/58/Default.aspx[^] but I am missing something.
Background, I have got a parent "frmMDI" who creates a new instance of class ReadModel readMdl = new ReadModel;"
class ReadModel
{
private string strModelDesc1 = "Model";
private int intNLAY = 1;
public bool SaveModelData(string strOpenFile)
{
etc
etc
}
public string inModel
{
get
{
return strModelDesc1;
}
set
{
strModelDesc1 = value;
}
}
}
Then the frmMDI calls a new instance of a child frmData that has textboxes etc allowing the user to give new values for strModelDesc1 and intNLAY.
This must then be saved later to a file. The problem that I have is setting the new values from the user on frmData back to the specific instance of class readMdl in frmMDI so that that specific instance of SaveModelData can save to a file and other classes can use it later on by reading readMdl.inModel etc. I can still get the info from the child (while it is open) get and set blocks but once it is closed then it is lost.
thanks for the patience
Ian
I could use static variables all the way but that would be stupid.
|
|
|
|
|
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.
|
|
|
|