|
Please put your code in <pre> tags so it is readable.
What is fis and files ? From the little bit of context provided, can we assume fis is defined as FileInfo[] ? There are multiple possibilities for files , most of which imply that it is some sort of collection or array. In that case, you won't have a CopyTo method.
There is also not a CopyTo(String, String) method on FileInfo , so is it safe to assume that you actually meant File.Copy(String, String) ?
In either case, both methods only operate on an individual file and all parameters must be a fully qualified file name.
They do the same work and one really isn't any faster than the other, so it all depends on how you are getting the original file.
|
|
|
|
|
I have a form with 3 textbox. when you press Tab then the textbox have a character which was blacken to you put new character. how i do it? Can you help me!
|
|
|
|
|
cam chuong wrote: when you press Tab then the textbox have a character which was blacken to you put new character.
Uhhh, what?? I have no idea what you're talking about. Are you saying that you WANT IT to put a small black box in the textbox when you hit the "Tab" key??
cam chuong wrote: how i do it? Can you help me!
Not unless you describe the problem better.
|
|
|
|
|
can i design my control style and shape as i like
for example like "jetAudio" program bottons
|
|
|
|
|
iprotoo wrote: can i design my control style and shape as i like
Sure. Permission granted. With a question like this, there's really no other answer possible. You just asked if you could do it. Sure, why not? The real question comes in now, "Do you have the ability to do it??" Only you can answer that...
Or did you have a real question, like what part of creating your own custom button class are you stuck on??
iprotoo wrote: for example like "jetAudio" program bottons
Never heard of it.
|
|
|
|
|
You can, and this is done using owner drawn code, so that's what you want to google on.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I'm not sure if what I'm after is possible.
I have 3 values stored in the DB, two being variables and the third an operator (ie =, !=, >= etc) - all stored as a string.
What I need is a function that evaluates the 2 variables based on the operator and returns true or false.
so if(var1 operator var2)
return true;
else: return false;
I know that I could do a switch statement to check what the operator is and then type the code for it, but I was wondering if there is a dynamic way in which I could get at the operator based on the string values of "=" or ">=" etc ? That would enable me to add more operators to the db without changing code. The operators I need to support from the start are =, !=, >, <, >=, <= however there might be more in the future.
Any help greately appreciated.
Jo
Joasia
|
|
|
|
|
You could use the CSharp.Compiler (see this article http://www.codeproject.com/cs/algorithms/matheval.asp[^]), but if you're concerned about efficiency at all, I'd go with the switch statement.
If you're using 2.0, you could write a template generic comparer class to handle variables of any type.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
There might be a fancier/more efficient way, but this works:
public class OpEval<T> where T : IComparable<T>
{
public static bool Eval( T arg1, T arg2, string op )
{
int c = arg1.CompareTo( arg2 );
switch( op )
{
case "=":
return c == 0;
case "!=":
return c != 0;
case ">":
return c > 0;
case "<":
return c < 0;
case ">=":
return c == 0 || c > 0;
case "<=":
return c == 0 || c < 0;
default:
throw new ArgumentException("Invalid operator");
}
}
}
Call like:
bool equal = OpEval<int>.Eval(50, 60, "=");
You get the idea...
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Or make a method for each operator, and have a Dictionary of them?
Hmmm... it's Friday...
|
|
|
|
|
Thanks for the opportunity to write this, may not be exactly what you want, but it was fun:
namespace Template
{
public partial class Template
{
public delegate bool opdelegate<T> ( T x , T y ) where T : System.IComparable ;
private static readonly System.Collections.Generic.Dictionary<string,opdelegate<System.IComparable>> ops ;
static Template
(
)
{
ops = new System.Collections.Generic.Dictionary<string,opdelegate<System.IComparable>>() ;
ops.Add
(
"=="
,
delegate
(
System.IComparable x
,
System.IComparable y
)
{
return ( x.CompareTo ( y ) == 0 ) ;
}
) ;
ops.Add
(
"!="
,
delegate
(
System.IComparable x
,
System.IComparable y
)
{
return ( x.CompareTo ( y ) != 0 ) ;
}
) ;
return ;
}
[System.STAThreadAttribute]
public static int
Main
(
string[] args
)
{
int result = 0 ;
try
{
if ( ops [ "==" ] ( args.Length , 3 ) )
{
System.Console.Write ( ops [ args [ 1 ] ] ( decimal.Parse ( args [ 0 ] ) , decimal.Parse ( args [ 2 ] ) ) ) ;
}
else
{
System.Console.Write ( "Syntax: Compar num op num" ) ;
}
}
catch ( System.Exception err )
{
System.Console.Write ( err.Message ) ;
}
return ( result ) ;
}
}
}
|
|
|
|
|
Hi everyone,
i have a datagridview for adding/updating rows to the sqlserver database..before adding a new row to the database, i want to check whether the record already exist in my databse to avoid dubble records in the database...any idea how to do that?
thanx,
djavid
|
|
|
|
|
Write a method in your C# code that calls a stored procedure that checks, based on the data being added, whether a matching record already exists.
Paul
|
|
|
|
|
Also you can set the column of the data grid's datatable which need to be unique to be true.
|
|
|
|
|
Hello everyone,
I was wondering if there is a way I can add some information like a serial number to a file. I am currently doing this with adding the serial number to the file name using the System.IO.FileInfo class.
Would it be possible to have the serial number somewhere more safer. something like Metadata used in mp3 file.
Thank you very much and have a great day.
Khoramdin
Khoramdin
|
|
|
|
|
Hi
Encrypt your serial number and keep it in registry/file.
Vikas Maan
|
|
|
|
|
hi
i want work with crystal reports in c#
who can i print one table that build with sql?
thank
ali
|
|
|
|
|
Hi,
Is there anyway to create the port for the printer and its interface?
I browsed online and couldnt' find any. I am not sure how to do it at all..
if you know any links or reference please tell me.
Thanks
|
|
|
|
|
Hi,
i don't really know what you mean by "create the port for the printer", but there are some articles on CP about using the printer-port in c#
For example: http://www.codeproject.com/csharp/csppleds.asp[^]
I hope this helped you a bit
|
|
|
|
|
Port like FILE;(Print to File) using existing HP print postscript driver.
There isn't actual physical printer.
Thanks.
|
|
|
|
|
If you've installed the driver for your virtual printer correctly, there should be no difference to printing on a physical printer.
|
|
|
|
|
You are right, but I can's save to the specific location for all the files at once. Everytime the document prints, I got Message Prompted asking me where do I want to save the output file.
Here what I did when I add new Printer.
1) Add Printer
2) Click Next
3) Select Local printer attached to this computer
4) Click Next
5) Print To File Port
7) Select Printer Driver like HP Laser Jet 5Si PS
When I print test page, the printer ask me where I would like to save every time I print.
I would I tell the driver to save all the printed pages to specific location with user defined name??
From what I userstanding, port is the one who saving all the printed data into specific location? If I'm wrong, please correct me.
Thanks.
|
|
|
|
|
Hello All,
I am having issues trying to convert XML to HTML using C#. I have done this before using simple style sheets and simple xml documents.
I now have to do this on a larger scale.
The current issue is that I get an XsltException stating 'matches()' is an unknown XSLT function. This exception is thrown on the xslCompiledTransform.transfrom call.
Is this a standard function? If so how do I use it?
If anyone can help me with this I would greatly appreciate it.
My code snippet.
String outputFile = outputFileTextBox.Text;
XmlUrlResolver resolver = new XmlUrlResolver();
XslCompiledTransform tran = new XslCompiledTransform(true);
tran.Load(new XPathDocument(xsltFileTextBox.Text), XsltSettings.Default, resolver);
tran.Transform(xmlInTextBox.Text, outputFile);
Thanks in advance for all the help.
Phillippio
|
|
|
|
|
Looks like a problem in the XSLT. Do you refer to matches() in there?
|
|
|
|
|
The call to matches() is in the xslt
<xsl:when test="matches(//geia:JA_transportation_data/geia:transportation_indicator, 'S')">
Is this function standard in xslt or do I have to import something to use it. If so how?
Thanks,
|
|
|
|