|
I NEED TO ASK YOU ONE THING. WHETHER ANY WRAPPER IS THERE IN C3 TO GET A LIST OF ICON AS HE TOLD ABOVE
hai, enjoy coding
Sreejith SS Nair
|
|
|
|
|
Do you have any "netiquette"? Don't type in all caps. Not only is it harder to read, but it's also called "flaming" and is an online form of yelling.
There is none in the .NET FCL, but there may be on this site. I do know that there are articles that talk about how to enumerate and get all the icons in an executable (note, this doesn't use IExtractIcon , which is used by the shell and other applications to extract a file association icon). I even wrote a C++ COM object (ATL) that does this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am really sorry for that violation. b'cause my keyboard is not worked properly on morning. Right now it is fine.
thanks for information
hai, enjoy coding
Sreejith SS Nair
|
|
|
|
|
My Dataset if filled with a table, I want to get distinct rows from non primary key column.
Thanks
|
|
|
|
|
Hi,
You can do that by using this function.
public DataTable SelectDistinct(string TableName, DataTable SourceTable, string FieldName,string FilterCondition)
{
DataTable dt = new DataTable(TableName);
dt.Columns.Add(FieldName, SourceTable.Columns[FieldName].DataType);
object LastValue = null;
foreach (DataRow dr in SourceTable.Select(FilterCondition, FieldName))
{
if ( LastValue == null || !(ColumnEqual(LastValue, dr[FieldName])) )
{
LastValue = dr[FieldName];
dt.Rows.Add(new object[]{LastValue});
}
}
return dt;
}
Hope this will help you....
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
dataset have a method called select(). using this method you can do your selection.
ie,
eg: you have a dataset which consist of customer table.
i think you know the basic things to open a connection and fetch record from table using any datadapter. am i right?
Ok
YourdataAdapter.Fill(YourDataset,"yourtablename");
so you have data on yourdataset.
next line is like this
dataset.table[0].select("distinct custname");
(here i used table[0] why b'cause only one table is there in dataset. otherwise you have to mention table name in double quarts inside the square bracket)
finally you can use datarow[] (recommanding) or someother dataset (if you want) to fetch the record.
datarow[] dr;
dr=dataset.table[0].select("Select distinct custname");
hai, enjoy coding
Sreejith SS Nair
|
|
|
|
|
Have you actually tried this, though? According to the documentation, the distinct keyword is not supported. The expressions that are supported are the same as those that are available to use in the DataColumn.Expression class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
EXTREMLY SORRY FOR THAT.
hai, enjoy coding
Sreejith SS Nair
|
|
|
|
|
Is it possible to programmatically remove namespaces from an XML string?
For example :
<ControlActEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:monkeys-org:v3" attrib1="A1" attrib2="A2">
Would become :
<ControlActEvent attrib1="A1" attrib2="A2">
OR
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Logon xmlns="http://www.domain.com/EP/">
<userId>int</userId>
<strPassword>string</strPassword>
<strSessionId>string</strSessionId>
</Logon>
</soap:Body>
</soap:Envelope>
becomes
<?xml version="1.0" encoding="utf-8"?>
<Envelope>
<Body>
<Logon>
<userId>int</userId>
<strPassword>string</strPassword>
<strSessionId>string</strSessionId>
</Logon>
</Body>
</Envelope>
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
You can do this by loading the XML in XmlDocument object and then extract each node in XmlElement object and do the necessary changes in that. Save the XmlDocument object at the end.
XmlDocument and XmlElement classes come under System.Xml namespace.
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Although Aryadip's solution was perfectly valid I found some sleeker ways of acheiving the same effect. Just incase anybody searches the forums at a later date here they are :
Method 1 - Using XML Text Readers
private string PGM_StripNamespaces(string xml)
{
XmlTextReader reader = new XmlTextReader(new StringReader(xml));
MemoryStream outputStream = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(outputStream, new System.Text.UTF8Encoding(false));
writer.WriteStartDocument();
while(reader.Read())
{
switch(reader.NodeType)
{
case XmlNodeType.Element:
writer.WriteStartElement(reader.Name);
if(reader.HasAttributes)
{
while(reader.MoveToNextAttribute())
{
if(reader.Name.CompareTo("xmlns") != 0)
writer.WriteAttributeString(reader.Name,reader.Value);
}
reader.MoveToElement();
}
if(reader.IsEmptyElement)
{
writer.WriteEndElement();
}
break;
case XmlNodeType.Text:
writer.WriteString(reader.Value);
break;
case XmlNodeType.CDATA:
writer.WriteCData(reader.Value);
break;
case XmlNodeType.ProcessingInstruction:
writer.WriteProcessingInstruction(reader.Name,reader.Value);
break;
case XmlNodeType.Comment:
writer.WriteComment(reader.Value);
break;
case XmlNodeType.EntityReference:
writer.WriteEntityRef(reader.Name);
break;
case XmlNodeType.EndElement:
writer.WriteEndElement();
break;
}
}
writer.WriteEndDocument();
writer.Flush();
writer.Close();
reader.Close();
return System.Text.Encoding.UTF8.GetString(outputStream.ToArray());
}
Method 2 - Using XSLT Transforms (what I opted for)
This requires the following XSL file
<xsl:stylesheet xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" version ="1.0" >
<xsl:template match ="@*" >
<xsl:attribute name ="{local-name()}" >
<xsl:value-of select ="." />
</xsl:attribute>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match ="*" >
<xsl:element name ="{local-name()}" >
<xsl:apply-templates select ="@* | node()" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Then use the following code
private string XSL_StripNamespace(string xml)
{
XslTransform xslt = new XslTransform();
XmlTextReader reader = new XmlTextReader(new StringReader(XSLT));
xslt.Load(reader, null, null);
XPathDocument mydata = new XPathDocument(new StringReader(xml));
MemoryStream outputStream = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(outputStream, new System.Text.UTF8Encoding(false));
xslt.Transform(mydata,null,writer, null);
return System.Text.Encoding.UTF8.GetString(outputStream.ToArray());
}
Variations of both these solutions were found here :
http://weblogs.asp.net/kaevans/archive/2003/06/13/8679.aspx
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Can I ask why you'd want to? XML namespaces are there for a reason - to qualify elements and from time to time attributes (the default for attributes is not to qualify them). If it's because you're having a hard time selecting what you want, make sure you create an instance of the XmlNamespaceManager (using the XmlDocument.NameTable as the ctor param) and add namespaces with any prefixes you want to use: the prefix you use and the prefix used in the XML document do not have to match - only the namespaces do. Also, there is a bug where you can't use an empty string to mean the default namespace - you have to always specify a namespace prefix.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
To be honest I am probably wanting to do this through a lack of knowledge than anything else.
I need to generate a generic codefunction that will parse out values from an XML string. Which sounds simple enough, load it into an XmlDocument, use Xpaths to extract data.
The problem is that the XML string may or may not contain namespaces. As I do not know which (if any) namespaces will be present, I cannot (I believe) create an XmlNamespaceManager. Without the manager I cannot use XPaths to retrieve values. By stripping them out I can easily process the document (at this stage of the code they are irrelevant to the application)
Feel free to enlighten me if I have gone speeding down the wrong track
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
If some elements are qualified with a namespace, then add a prefix with an empty string for the namespace to the XmlNamespaceManager . Stripping namespaces can often be very dangerous. Lets say, for example, you wanted to modify a SOAP document. If you strip the namespaces and then send it to the server or the client, it will fail because the SOAP elements won't be found.
There is plenty of documentation on XML namespaces both on MSDN and elsewhere on the 'net. If you want the technical specification, see the XML namespaces spec on the W3C site at http://www.w3.org/TR/REC-xml-names[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello gurus,
I can send/receive bytes using sockets using SocketStream.Write or SocketStream.Read with a buffer of bytes with a fixed length.
I would like to send a class or a structure with a variable length??? How can I do that? Where can I get a sample C# code?
Thanks for the help.
Best regards.
There is no spoon.
|
|
|
|
|
You can send objects with the BinaryFormatter and SoapFormatter classes in System.Runtime.Serialization.Formatters.
A sample is in the documentation of BinaryFormatter.Serialize.
|
|
|
|
|
Hello gurus,
There is no spoon.
|
|
|
|
|
Hi!
Yes, there is a spoon! I'm using it to dig myself out of prison!
RageInTheMachine9532
|
|
|
|
|
And "because it hurts more!" (in regard to digging someone's heart out with a spoon )
Is that how you got into prison?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
oops, sorry...
It seems I posted two times this topic... sorry :p
There is no spoon.
|
|
|
|
|
I took a wrong turn somewhere...
I got this map from a smart-ass, grey rabbit, and well, you know...
RageInTheMachine9532
|
|
|
|
|
Hello,My problem is that In my project I have added 3 small C# project files each containing references of some C# dll's which is also contained in that project folder .Now when I copy the entire folder to some new place and run it from there ,it doesn't run independently..i.e. making changes from new place affects older one...if anyone have idea in this regard then plz answer ...thanks in advance
Bugfixer
|
|
|
|
|
u have a solution with more than one project. right.
What you can do is. Simply copy the namespace name of first project that you added in your solution to further all project.
if it is fine then go ahead other wise you can contact me i will write to you step by step.
hai, enjoy coding
Sreejith SS Nair
|
|
|
|
|
When you add references to other projects in the Add Reference dialog, click on the Project tab and select the projects from there instead of using the assemblies themselves. Not only does this keep your build configuration in sync (so that when you do a release build, the release assemblies from each project are used), but it also establishes build dependencies so that if you make a change in a dependent project and compile the project that depends on it, both are recompiled.
Also: a word of warning. Using automatically generated assembly versions (when you specify an asterisk (*) in your AssemblyVersionAttribute is dangerous in large solutions, especially when there doesn't exist a dependency that covers all projects (so that your executable would have a local copy of all current assemblies in your solution).
This is the correct way of solving this problem. The right assemblies using the right build and compiling against the right versions is always kept in sync.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to get the estimated time left when the program executing.
thanks.
Rock Throught The Night
|
|
|
|