|
I have a pc remote control and I want to capture his keycodes and to change their functions. how can I do this?
|
|
|
|
|
Hello Friends,
I am developing an C#.NET application and i am able to get data in DataGridView1 from SQL Server 2000 now i want that if someone wants to edit data in datagridview1 then it will save in the database.
So how can i achieve this....
|
|
|
|
|
|
I'm starting to pull my hair out and hope somebody can help stop me from becoming bald!
I have a Class - LookupItem that uses XmlRoot attribute so that when serialized individually outputs under element named Item.
Now if I have a List<lookupitem> when I serialize it the lookup item class always serializes as LookupItem and not Item.
What I'm wanting to see is:
<Clean>
<Item>
....
</Item>
</Clean>
but all I get is:
<Clean>
<LookupItem>
....
</LookupItem>
</Clean>
The code I'm currently using to do the serialization is below, but I have tried doing serialization with extra types, XmlAttributeOverrides and still cannot get the output correct.
<br />
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();<br />
ns.Add("", "");<br />
<br />
XmlAttributeOverrides xao = new XmlAttributeOverrides();<br />
<br />
XmlRootAttribute xr = new XmlRootAttribute("Clean");<br />
XmlSerializer s = new XmlSerializer(typeof(LookupItemList));<br />
<br />
XmlWriterSettings settings = new XmlWriterSettings();<br />
settings.OmitXmlDeclaration = true;<br />
<br />
StringWriter output = new StringWriter();<br />
XmlWriter writer = XmlWriter.Create(output, settings);<br />
<br />
s.Serialize(writer, Clean, ns);<br />
writer.Close();<br />
<br />
output.ToString();
Can anybody help me at all?
|
|
|
|
|
I think you need to apply the XmlRootAttribute to the LookupItemList class. So Something like:
[XmlRoot("Clean")]
public class LookupItemList ...
Then you would need to do the same thing with the LookupItem class, but use XmlElementAttribute to define the name as "Item".
FYI...In your code example above you don't use xr or xao anywhere, are you sure this is the code you are using?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Sorry Tom,
Just realised code posted not quite correct I'm using:
<br />
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();<br />
ns.Add("", "");<br />
<br />
XmlSerializer s = new XmlSerializer(typeof(LookupItem));<br />
<br />
XmlWriterSettings settings = new XmlWriterSettings();<br />
settings.OmitXmlDeclaration = true;<br />
<br />
StringWriter output = new StringWriter();<br />
XmlWriter writer = XmlWriter.Create(output, settings);<br />
<br />
s.Serialize(writer, toSerialize, ns);<br />
writer.Close();<br />
<br />
return output.ToString();<br />
The root element won't help unfortunately since I'm trying to serialise a List<t>, even if I did create a specialist list based on type T all I get output is the correct root element, the issue is the items in the list being output with the correct element name as specified by myself using XmlRoot("Item") on the class that is stored in the list.
|
|
|
|
|
For the LookupItem class you should use the XmlElementAttribute (I think). So something like this:
[XmlElement("Item")]
public class LookupItem ...
The XmlRootAttribute is only good for the root item in the XML doc (of which there is only one). Let me know if this doesn't work, though.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
XmlElement can not be used on a class only property, index, field or param.
The XmlRoot attribute simply tells the serializer that for this particular class to use a specific name for the node, it doesn't directly relate to the root element of the doc.
Cheers
Nathan
|
|
|
|
|
Sorry, my memory isn't what is used to be Here is the code that should do what you want...
[XmlType(TypeName = "Item")]
public class LookupItem {
}
[XmlRoot("Clean")]
public class LookupItemList : List<LookupItem> {
}
I'm assuming you are using a generic List and that you are serializing the List as the root object.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
XmlType - of course!
Got so hung up on the XmlRoot that I completely forgot about that.
Got it all serializing lovely now, managed it without a specific class by simply providing a XmlRoot attribute to the serializer.
Thanks Tom
|
|
|
|
|
Hi friends,im using updatepanel.Session is not expiring..even i do Session.Abondon(),Session.Clear(),Session.RemoveAll()...but after doing log out,if i hit back button,its still working..how can i ban it..?
Hi,Im Razana
|
|
|
|
|
You could probably use the logout event to clear the session (session.clear or session.abondon);
Treat the page_load event and check for the session("UserID") (or whatever you are interested in...)
But, is it not the wrong forum?
SkyWalker
|
|
|
|
|
I know that ZedGraph is a good tool to plot 2D figures.
Is there similar free source code to plot 3D ones, which can be used in VC#?
Thank you ver much.
|
|
|
|
|
Why wouldn't you have a look here at CP[^]?
SkyWalker
|
|
|
|
|
hi,
if i am using folloing code to open a perticular xml file,
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open XML File";
dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ;
if (dlg.ShowDialog() == DialogResult.OK)
{
doc.Load(dlg.OpenFile());
}
and now if i want to read a file name in the xmltextreader , how can i read it?
|
|
|
|
|
|
|
Hi All,
I am developing a c# app which calls a function in a c++ dll. For this function to work the calling application must have a privilege certificate as the function i am calling is a privilege API(lineGetGeneralInfo).
Does anybody know how yo use this function in my app??
|
|
|
|
|
I'm sorry guys, but google is not working today .. No, seriously, I keep getting some redirection message to sorry.google.com.. anywayz, my main function has some string[] args and I want to know what's happening to the passed parameters and cant do it from the IDE, please help me..
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello Muammar!
I'm not shure if I understand your question, or better what you think you don't understand.
Pathing arguments:
using System.Diagnostics;
ProcessStartInfo PSItest= new ProcessStartInfo();
PSItest.FileName = @"???";
PSItest.Arguments = "oneargument";
PSItest.Arguments = "firstargument secondargument";
using(Process Ptest = Process.Start(PSItest))
{
}
Getting arguments:
public static void Main(string[] Args)
{
string arg1 = "";
string arg2 = "";
if (Args.Length > 0)
{
arg1 = Args[0];
}
if (Args.Length > 1)
{
arg2 = Args[1];
}
}
All the best,
Martin
|
|
|
|
|
Hey Martin!
Good to hear from you buddy , thank you for your help and I'm sorry my question wasnt clear, I just meant to watch my parameters getting processed, the other answer is what I was looking for but thanks anyways for your time Martin...
BTW: Your new icon looks great ..
Have a nice day Martin!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Are you trying to debug the parameters passed ? Then choose Project Properties - > Debug - > Command line arguments . There you can supply them
|
|
|
|
|
Thanks buddy
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
What the other said works, but I understood from you was you don't/can't do this from the IDE. So what you can do is the following:
static void Main(string[] args)
{
#if DEBUG
args[0] = "string1";
args[1] = "string2";
#endif
}
|
|
|
|
|
Cool!! I Didnt know this, thanks man!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|