|
That's exactly what I'm looking for!
Thanks! (I accidentally selected "custom control" which is entirely different and confused my one-track mind).
|
|
|
|
|
Hey friends, I have been searching but couldn't find any examples where i can make my custom controls transparent (see through). Is it even possible to do in C#.
thanks
|
|
|
|
|
|
Did you try setting the controls backcolor to Color.Transparent?
|
|
|
|
|
I am controlling the paint method but when i set the style in the constructors it does funny thing but still my control is not tranparent
public UserControl1()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.FromArgb(0, 0, 0);
}
|
|
|
|
|
Isn't (0,0,0) black?
Did you try
this.BackColor = Color.Transparent;
?
|
|
|
|
|
Or pehraphs you could even use the correct overload, with that extra zero for the alpha channel. Which is what you want.
this.BackColor = Color.FromArgb(0,0,0,0);
Also, Color.FromArgb(0,0,0,0) == Color.Transparent; or at least the result is the same.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Can anybody give me link or suggestions on implementing good exception handling mechanism in the C# project. Not just try...Catch block but beyond that.
I have something in mind,
1. Create something like Error Dictionary (resx file) with user-defined Error Codes, Description and build my own error information with user-defined exception class.
2. This class may accept error code or something for generating good exception object, which can be thrown to the consumer.
3. Exception Consumer will then use this object and pass it to Some class, which eventually will display Vista Type task dialog where atleast Title, Main Instruction and Description of the errors will be shown.
Any Inputs are very much appreciated.
Thanks
|
|
|
|
|
Why have a method return an error code which you pass to an error code processing method when you can just throw the appropriate exception when it occurs. Your stack trace looks right that way.
|
|
|
|
|
eggsovereasy wrote: Why have a method return an error code which you pass to an error code processing method when you can just throw the appropriate exception when it occurs.
Why? Obviously it's an exceptional condition.
led mike
|
|
|
|
|
Thanks for the reply. Only the thing i want to know is the best design to implement Exception\message Handling, using custom exception classes and resource files contains errors/message keys and descriptions.
Thanks
|
|
|
|
|
I represented the data in Crystal Report based on certain conditions. which is stored in a table "abc" .
I used CrystalReportViewer Control and my Crystal Report name is crystalreport1.rpt . and control name is crystalreportviewer1
I have a task to convert that report into pdf file and save into a folder(output) in Drive C: . and also to open that pdf file after creating the pdf.
My question is what will be the C# code to convert Crystal Report into pdf files and stored in that folder of drive C: .
|
|
|
|
|
I have converted this code from vb without testing, so please correct any syntax error ...
<br />
DiskFileDestinationOptions DiskOpts = New DiskFileDestinationOptions();<br />
oReport.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile;<br />
oReport.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat;<br />
DiskOpts.DiskFileName = ExportPath + requiredFilename;<br />
oReport.ExportOptions.DestinationOptions = DiskOpts;<br />
oReport.Export();<br />
crViewer.ReportSource = null;<br />
oReport.Dispose();<br />
oReport = null;<br />
<br />
Response.Clear();<br />
Response.AppendHeader("Content-Disposition", "attachment; filename=filename.pdf");<br />
Response.ContentType = "application/pdf";<br />
Response.WriteFile(ExportPath + requiredFilename);<br />
Response.End();<br />
<br />
<br />
Response.Redirect(pdffilenameandpath, true);<br />
<br />
-----
|
|
|
|
|
Is there any dll file needed to convert into PDF
|
|
|
|
|
A few statements from how I run a Crystal Report via a Windows Service:
Defile is a FileInfo indicating the RPT file.
reportfile is a FileInfo indicating the destination for the PDF.
CrystalDecisions.CrystalReports.Engine.ReportDocument crRpt =
new CrystalDecisions.CrystalReports.Engine.ReportDocument() ;
crRpt.Load ( Defile.FullName ) ;
crRpt.SetParameterValue
(
parm.Key
,
parm.Value
) ;
crRpt.ExportToDisk
(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
,
reportfile.FullName
) ;
|
|
|
|
|
I am just learning XML and C# so I appoligize for any inconvience in advance. The program I am working on interfaces with another program that I did not write. I create a XML request for the program to do something and it responds with an XML response that tells me if it was succesful. The problem I have is parsing the response to find out if there are any errors. A basic response looks like this:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnErrror">
<CustomerAddRs statusCode="3110" statusSeverity="Error" statusMessage="The name was not valid"></CustomerAddRq>
<VendorAddRs statusCode="0" statusSeverity="None" statusMessage="Vendor succesfully added"></VendorAddRs>
</QBXMLMsgRq>
</QBXML>
The problem I have is that each of the elements could be different, as in this case, there is a VendorAddRs element and a CustomerAddRs element. I have been trying to use the XmlTextReader and XMLDoc to try and check to see if the statusCode is something other than 0.
A lot of the information I have found assumes that you know what element you are looking for. I don't care what the element is (if it's a customerAdd or a VendorAddRs) but really what the statuscode is and what the statusmessage is the code is anything other than 0.
I was thinking that I could just read through the xml and see if the node I'm at has any attributes, and if it does, check the first attibute to see if it starts with "statusCode" but that hasn't worked so far.
If there is an article or a post that someone could point me to, I'd appreciate it, as I have not had any luck finding an article that addresses this.
Thank you so much for your time.
|
|
|
|
|
If you know the attribute name you could use XPath:
XmlDocument myXMLDoc = new XmlDocument();
myXMLDoc.Load(responseStream);
XmlNode myAttribute = myXMLDoc.SelectSingleNode("//@attributeIAmLookingFor");
This is a very good XPath tutorial.[^]
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
Wow! XPath seems really usefull for XML! Thank you very much for the article!
It appears that this is what I need. Since there can be multiple elements in one document that have statusCodes, I would venture to say that I should use:
XmlNodeList myNodeList = myXMLDoc.SelectNodes("//@attributeIAmLookingFor");
foreach(XmlNode n in myNodeList)
{
// Check the value of the node 'n' to see if it != "0"
}
I'm going to do some testing on this right now and then sit down and read up on XPath some more!
Thanks again!
|
|
|
|
|
hpjchobbes wrote: Since there can be multiple elements in one document that have statusCodes, I would venture to say that I should use:
XmlNodeList myNodeList = myXMLDoc.SelectNodes("//@attributeIAmLookingFor");
foreach(XmlNode n in myNodeList)
{
// Check the value of the node 'n' to see if it != "0"
}
There you go my friend!
If your document uses XML namespaces, it can get hairy. In that case, you will have 2 choices:
1) Use the class XmlNamespaceManager in your calls to SelectNodes, if your XML document uses prefixes.
2) If it does not use prefixes, you will have to resort to fully-qualified XPath queries, like:
//@*[local-name()='attributeIAmLookingFor' and namespace-uri()='http://somenamespace.com']
This is an alternative XPath syntax. Also, from your example above, you could save some code:
//@*[local-name='attributeIAmLookingFor' and namespace-uri()='http://somenamespace.com' and number()!=0]
Have fun!
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
Evening guys,
Hopefully a quick question.
I am trying to iterate all sub directories within a folder using the DirectoryInfo.GetDirectories()
This isall fine until the search hits a directory that I do not have permisions for, unfortunately at this point an UnathorisedAccessException is thrown which is perfecty understandable.
What I would like to do is retrieve a list of directories that I do have permission for and ignore any that I don't.
Any ideas?
Many thanks
Paul
ps, what event is it thrown for the enter key on a text box??
Paul
|
|
|
|
|
Hi,
the only way that works for me is by using SearchOption.TopDirectoryOnly and performing the
recursion myself, with a try-catch inside the foreach that iterates over the subdirectories at
the current nesting level.
I see no real use for SearchOption.AllDirectories because of the possible exceptions it does
not handle well.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Sounds good, many thanks
Paul
|
|
|
|
|
pprice wrote: what event is it thrown for the enter key on a text box??
handle one of the text boxes Key Events and check the event args to see if the KeyCode is Keys.Enter
|
|
|
|
|
Kinda hoped there would be a more specific event that I did not know about, ho well, many thanks anyway
Paul
|
|
|
|
|
Hi,
I have a app that i want to embed in a ASP.net page but i dont know where to start. Does anyone have any articles or info on how to go about embedding a c# control on a asp page?
Regards,
Gareth.
|
|
|
|