|
hi
Try this
this.rtb.SelectedText="Text To insert";
hope this works...
Nitin...
|
|
|
|
|
Thank you very much Nitin...this works...
Plain Old Coder
|
|
|
|
|
I am trying to find a class to get the system info (i.e. memory usage, disk space...). I have seen several references to a System.Mangament class but its not list in the .net MSDN help files and doing a "using System.Management;" creates an error. Any ideas.
|
|
|
|
|
sj_h1 wrote: I have seen several references to a System.Mangament class but its not list in the .net MSDN help files
If you are looking for "System.Mangament" I can understand that your search results were sparse. Perhaps if you look for "System.Management[^]" instead...
---
b { font-weight: normal; }
|
|
|
|
|
very funny...now try to be helpful
|
|
|
|
|
sj_h1 wrote: very funny...now try to be helpful
I marked the reply as "Answer" because it is supposed to be helpful, eventhough the joke is on you for misspelling the namespace.
Just click on the link that I included in my post, and you will come to the documentation.
---
b { font-weight: normal; }
|
|
|
|
|
Before you can add a
using System.Management; using directive in your code, you'll need to add a reference to the System.Management.dll
|
|
|
|
|
Thats the very information I need. How do I do that.
|
|
|
|
|
How do you add a reference to your project? That's pretty basic: in Visual Studio, in the Solution Explorer window, under your project, right-click the References folder, then click add reference. In the window that pops up, scroll down to the System.Management.dll, select it, and hit OK.
|
|
|
|
|
|
I want to generate a svg using c# and DOM. I have:
<br />
XmlDocument mySvg = new XmlDocument();<br />
XmlDeclaration declaration = mySvg.CreateXmlDeclaration("1.0", "UTF-8", "no");<br />
mySvg.AppendChild(declaration);<br />
XmlDocumentType doctype = mySvg.CreateDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);<br />
mySvg.AppendChild(doctype);<br />
The problem is that the DTD is retrieved from the internet and that gives a huge overhead to my application. I downloaded the DTD and I want to make it SYSTEM instead of PUBLIC but I haven't found a way to do this using CreateDocumentType. The only alternative I could think of is mySvg.Load(LongStringWithXML).
|
|
|
|
|
Hi,
can someone help me with replacing a value in a XML file? The whole cycle starting with the filename - i.e. load/replace/save, or however this should be done)
The value is the contents of a simple tag,
<FOO><BAR>...<BAZ>0</BAZ>...</BAR></FOO>
(I want to set the BAZ value to 1)
thanks in advance!
|
|
|
|
|
This should work:
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.Load( "myxml.xml" );<br />
<br />
XmlNode node = xmlDoc.SelectSingleNode( "/foo/bar/baz" );<br />
<br />
if ( node != null )<br />
{<br />
node.InnerText = "1";<br />
}<br />
<br />
xmlDoc.Save("myxml.xml");<br />
as long as there's only one baz element, otherwise you need to iterate over the nodes using SelectNodes or use xpath to determine which unique baz you want, like: xmlDoc.SelectSingleNode( "//foo/bar/baz[@id='123']" ).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
This almost works
The document gets loaded correctly (according to the debugger) - but the selectsinglenode doesn't work.
Here's the XML:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>8.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>
<Addin>
<FriendlyName>peterchens Linkify</FriendlyName>
<Description>Link source code comments to external documentation</Description>
<AboutBoxDetails>For more information, see the respective article at codeporject.com\r\n\r\nCopyright (c) 2006 Peter Hauptmann</AboutBoxDetails>
<AboutIconData>(blubber blubber)</AboutIconData>
<Assembly>D:\Sources\C#\Linkify\bin\Linkify.dll</Assembly>
<FullClassName>Linkify.Connect</FullClassName>
<LoadBehavior>1</LoadBehavior>
<CommandPreload>1</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
</Addin>
</Extensibility>
I need the LoadBehavior and CommandPreload elements, but SelectSingleNode("/Extensibility/Addin/LoadBehavior") returns a null node. can you help?
|
|
|
|
|
Hmph. If I change the xml files encoding to "UTF-8", and remove the xmlns attribute, it works for me.
I don't know much about Unicode, so maybe you need to adjust those two attributes, or change the parameter of SelectSingleNode (again, I don't know how to tell it its unicoded).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
<br />
XmlDocument document = new XmlDocument();<br />
document.Load("YourXML.xml"); <br />
<br />
XmlNodeList nodeList = document.SelectNodes("//BAZ");<br />
foreach (XmlNode node in nodeList)<br />
node.InnerText = "1";<br />
document.Save(".\YourXML.xml");<br />
I am sure you can work with that to enhance it (This code assumes that you have the XML file in the same folder with the executable file. It also assumes that you want to modify all the <baz> nodes values if there are more than one.)
Good luck coding
//I posted at the same time
|
|
|
|
|
|
When the BinaryWriter writes the string to the file, it does so in a format so that the string can be read again. To know how to read the string, it has to write the length of the string before the characters in the string.
If you just want to write the characters in the string, you have to do exactly as you have done; writing them as an array of characters.
I can't think of any other data type that is handled the same way, but if it can be of variable size, the size has of course be included when it's written to the stream.
---
b { font-weight: normal; }
|
|
|
|
|
|
Lord Kixdemp wrote: what kind of data is the size option? It's only 1 byte... Does that mean what the string type can only contain 256 chars?
Surely not. I am sure that it has some solution to allow longer strings. My guess is that the value 255 means that a full 32 bit length follows.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
After executing a thread method, I am getting this error,
Attempted to read and write protected memory. This is often an indication that other memory is corrupt.
Is there any way to get rid of this problem ? I am not sure which block of the code is throwing this exception.
Regards
|
|
|
|
|
bashiwala wrote: I am not sure which block of the code is throwing this exception.
The unsafe one.
Try adding some exception handling code...
|
|
|
|
|
having this error after closing a socket. immediately after closing an asynchronous socket I get this exception. vs 2005 does not show any line to debug
|
|
|
|
|
You are right. It comes just after closing asynchronous operation and no line information is given. What approach you followed to solve the problem... any idea ?
|
|
|
|
|
I'm using the color picker to allow a user to specify a background color and I want to set the text color to be the inverse.
I thought the Color object had an inverse property but it doesn't.
Does anybody know how to do this?
|
|
|
|