|
I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
>>I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
It seems to be that I want!
Thanks a lot!
|
|
|
|
|
I don't think the fractional parts is a requirement but a restriction. 4, 4.0, 4.00, 4.000, and 4.000 would all be valid according to the XSD schema.
If you are really picky add some attributes to the Gross property
System.Xml.Serialization.XmlElement("Gross")
System.Xml.Serialization.XmlType("decimal")
and then modify the property as required (ie return a string)
BTW, I keep saying this because I am an ass but xml elements should be camelCase.
File Not Found
|
|
|
|
|
Surely values 4, 4.0, 4.00, 4.000 would all be valid according to the XSD schema.
But I need formatting according XSD schema
Unfortunately, I can't change the type from decimal to string - type of elements must be decimal.
Thanks for help!
|
|
|
|
|
Changing the type of the property but adding the name and type attributes allows you additional formatting over the type. You can return a string and tell the serializer it is a decimal and it will believe you.
File Not Found
|
|
|
|
|
Yes! It works!
I can't change the type of the values of object Mass,
but I can add other values for serialization only.
As a result, I can use values of decimal type inside my code,
but when I need serialization I will use wrap-properties for my decimal values.
public partial class Mass<br />
{<br />
private decimal grossField;<br />
private decimal netField;<br />
<br />
[XmlIgnore]<br />
public decimal Gross<br />
{<br />
get{return this.grossField;}<br />
set{this.grossField = value;}<br />
}<br />
<br />
[XmlElement("Gross")]<br />
public string GrossAsString<br />
{<br />
get{return Utils.DecimalToString(this.grossField,3);}<br />
set{this.grossField = Convert.ToDecimal(value);}<br />
}<br />
<br />
[XmlIgnore]<br />
public decimal Net<br />
{<br />
get{return this.netField;}<br />
set{this.netField = value;}<br />
}<br />
<br />
[XmlElement("Net")]<br />
public string NetAsString<br />
{<br />
get {return Utils.DecimalToString(this.netField, 4);}<br />
set {this.netField = Convert.ToDecimal(value);}<br />
}<br />
}
public class Utils
{
private const string PATTERN = "########################################.";
public static string DecimalToString(decimal d, int precision)
{
return d.ToString(PATTERN.PadRight(PATTERN.Length + precision, '0'));
}
}
Thanks a lot!
|
|
|
|
|
d.ToString("#.0000") should work with d as a decimal
File Not Found
|
|
|
|
|
Thanks
|
|
|
|
|
I actually want to open Notepad on a remote machine.
By writing the following code, I am able to run it, but the problem is that is runs in background. I can only see it by opening up the windows task manager.
ConnectionOptions objConnectionOptions = new ConnectionOptions();<br />
objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate;<br />
objConnectionOptions.EnablePrivileges = true;<br />
objConnectionOptions.Username = strUserName;<br />
objConnectionOptions.Password = strPassword;<br />
ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions);<br />
objManagementScope.Connect();<br />
<br />
ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null);<br />
ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create");<br />
inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe";<br />
ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null);
Is there anyone who could help me in sorting out this problem
Thanks.
Sarfraz
|
|
|
|
|
I already told you[^] WMI cannot be used to launch a remote interactive process. It's a huge security risk.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
I don no how to frame a question for this problem.
e,g.I am having two forms like fr1,fr2 and one button bt1.
through fr1 bt1 click event i wil open fr2.
my question is unless I close the fr2 i should get acees to fr1.
Pls help me..
With Regards
Prasad
|
|
|
|
|
hiremath71 wrote: my question is unless I close the fr2 i should get acees to fr1.
Instead of using fr2object.Show() method use fr2object.ShowDialog(this)
|
|
|
|
|
I'm not sure I really understood what you want, but I'll give it a try.
In case, you want the user to be able to access form1 while form2 is open, use the Show method to open form2. Otherwise use the ShowDialog method.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
I am using C# together with ASP.net.
I need to check if the screen resolution is equal or bigger than 1024 x 768, if not so, the page wil display a message that wil inform the user to change his res.
Thanks
Icarus
|
|
|
|
|
This question has better chances to be answered in the ASP.NET forum.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
I don't think this is going to work as the C# code is going to be running on the server, not the client. You need to look at one of the client side scripting technologies, like JavaScript, but I'm not sure it's possible.
The better question is why does your web app require that high of a resolution?
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
i have an RMS file 7-bit
how i can read it ???????????
|
|
|
|
|
With a FileStream ... However, your problem will be how to interpret it.
|
|
|
|
|
Hi,
I have one c# application in which I am using a DirListBox control.Its working finely but I am not getting a way for retrieving the elements of the control.Like - If I want some ith element from the DirListBox to compare it with some string and then continue with some action.Any idea would be helpful to me.
|
|
|
|
|
One simple question,
if an event is declared like a field of delegate type, except that the keyword event precedes the event declaration how can an interface contain a type declaration?
Jayant D. Kulkarni
|
|
|
|
|
jdkulkarni wrote: how can an interface contain a type declaration?
It can't. An interface can only contain signatures of the following members: Methods, Properties, Indexers and Events. (interface (C# Reference)[^]
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Yes, thats right. But I can not have
delegate void MyDelegate();
but I can have
event MyDelegate MyEvent;
I am asking @ this scenario.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
jdkulkarni wrote: But I can not have
delegate void MyDelegate();
but I can have
event MyDelegate MyEvent;
I am asking @ this scenario.
And you have (more or less) already answered yourself. The first is simply not possible, since an interface can only contain signatures of the following members: Methods, Properties, Indexers and Events; and this delegate void MyDelegate(); declares a type that references a method.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi All,
Greetings. I need to detect pop block status and have to display in my appilcation. I used the following code for it.
<br />
function detectPopupBlocker() <br />
{<br />
var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");<br />
if (!myTest) {<br />
alert("A popup blocker was detected.");<br />
} else {<br />
myTest.close();<br />
alert("No popup blocker was detected.");<br />
}<br />
}<br />
but its not working.it is working only for else part for both popup ON and OFF. Can any one of you tell me a solution to solve this issue.
Thanks in Advance
babu
|
|
|
|
|
i want to write some variables values to an xml file
then
read these files into local variables into myapplication from xml file
ma_refay
|
|
|
|