|
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
|
|
|
|
|
Take a look at the classes in the System.Xml namespace especially XmlDocument , XmlTextReader and XmlTextWriter .
"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 have about 30 image on my form
5 images per row
i want to store the image_row & image_no in array
so i want 2 dimension arrayto store image position in that way
0,0 first row & first image
2,4 third row & fifith image
and so on
ma_refay
|
|
|
|
|
Hello,
You could use an ArrayList or Hashtable and Add another ArrayList or Hashtable or ImageArray to each member.
All the best,
Martin
|
|
|
|
|
Hi,
I have to store a list as an external file of part codes and corresponding descriptions for later retrieval by other applications. What's the best way of doing it?
Each entry in the list consists of two strings, a part code and a description. I could just write to a text file and read from it again or should I use XML? Anyone have any ideas or examples of how to implement such code?
Thanks
|
|
|
|
|
Personally, I always favor XML over a plain text file. First, you can define an additional schema that allows you and other applications to easily validate whether the XML file contains data in a valid format. Second, you can use XPath to easily lookup the description for a part code. Finally, you are probably able to use the XmlSerializer class to easily create the Xml file in your application; depends on the way the you implemented the list to be stored in your application.?
"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
|
|
|
|