|
I have a Qty field in the grid. To validate this field i have used the code given at the end.
I tried various regular expressions representing decimal value, but none is working.
For all the cases, for '.' e.handled is set true. So, i am not able to get '.' as input. Can anyone help me:
private void tb_KeyPress(object sender, KeyPressEventArgs e)
{
string regexstring = @"(\d+)|(\d*\.\d{1,2})";
Regex reg = new Regex(regexstring);
if (reg.IsMatch(Convert.ToString(e.KeyChar)))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
|
|
|
|
|
What is the purpose of assigning the upper/lower threashold values in order to find specified words in a given txt by Pseudonym67 ? How does it apply to the Fuzzy operations?
What will be the effect of not using the threashold values in the Fuzzy Word Example by Pseudonym67?
jinendra
-- modified at 7:28 Saturday 28th October, 2006
Jinendra
|
|
|
|
|
Hi,
I've got to import a collection of text files into a database, the collection being anywhere between 3 and 20 files in size.
A typical collection would look like
1 x AD?????????.txt
1 x LB?????????.txt
? x PL?????????.txt
There can be anywhere between 1 and 20 PL files at any one time.
I'm wondering on what the best way is to deal with the files with multiple versions, ie the PL files. Is it better to create a new file and append all of the text from the PL files into it before import? If so, how? I know there is a FileMode.Create method but am unsure as how to use it. Any tips on this or suggestions on a better approach would be greatly welcomed.
Thanks a lot
Scott
|
|
|
|
|
Are you creating these files, or just importing them into the database?
If it's an import, just traverse through the directory and get the files that match your file mask, and import them one at a time. It seems like a longer process to concatenate the files. In the case of an error, you will know exactly which file caused the exception when they are imported separately.
|
|
|
|
|
Hello,
I have a server ( run under NT\SYSTEM because launch by windows service )
This server look after inserting usb key.
I have on the same computer, a client ( run under domain\login ) insert an usb key.
Only the client can eject the usb key
The serveur cannot ( message exception is : RemoteMachineNotAvailable )
How server can execute fonction eject ( CM_Request_Device_Eject ) with the identity of the user ?
thanks
PLEASE HELP ME !!!!
Vincent
|
|
|
|
|
What is the fastest way to find a string in .NET? I have a set of strings and I want to know whether a certain string exists in the set or not. Time is critial for this operation so I am looking for the fastest way.
* There will be no duplicates in the set.
* The order of the strings is unimportant.
* The number of strings in the set is likely to range from a couple to a couple of hundred. Typically, I expect the set to contain about a dozen or so strings in most situations.
|
|
|
|
|
Put the strings in a Hashtable.
You probably won't notice much of a time difference when you have as few as a dozen strings, but for a couple of hundred strings it's a lot faster.
---
b { font-weight: normal; }
|
|
|
|
|
|
I would also consider using a generic list of strings. I've been using List<> a lot lately, and it is very very nice.
What I would do, is add your strings to the list and then sort it.
Once it's sorted, use the List<>.BinarySearch to find the string. It really is fast - I've run tests with a 100,000 complex objects where it takes less than a millisecond to find a particular item. I know that this is not a particularly scientific test, but it does indicate that this is a really fast method.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Once it's sorted, use the List<>.BinarySearch to find the string. It really is fast - I've run tests with a 100,000 complex objects where it takes less than a millisecond to find a particular item. I know that this is not a particularly scientific test, but it does indicate that this is a really fast method.
A binary search in 100,000 strings should need no more than 16 or 17 comparisons, so I would expect it to take far less than a millisecond.
Yes, BinarySearch is very fast, but it still uses string comparison. A hash table compares the hash codes of the string, which are integers, so the comparisons are a lot faster.
---
b { font-weight: normal; }
|
|
|
|
|
Indeed, but it has to be said that generics are so cool I missed templates when I moved over from C++ to C# (back in version 1), and I have to say that MS have done a good job of implementing them here. Now, what we need are the equivalents of the STL for .NET.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Now, what we need are the equivalents of the STL for .NET.
You mean like System.Collections.Generic?
---
b { font-weight: normal; }
|
|
|
|
|
It's a start, but by no means complete. STL is so much more than just collections.;)
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I want to create a window service which should be just like a FileSystemWatcher. I want to watch a particular folder. If a file is put in that folder i want to call a method. Any suggestion is welcome.
thanx in advance
|
|
|
|
|
What have you done so far? It seems pretty straight forward.
|
|
|
|
|
hi
i want create ParameterField class in my app but i don't found it in crystalreport NameSpace, where it ?
and ReportDocument does not have a ParameterFields property.
Here is Code :
ReportDocument report = new ReportDocument();
report.Load(@"MyReportFile.rpt");
//i could not create ParameterField because i don't found it in crystal report namespace
foreach(ParameterField field in report.ParameterFields) {
if(field.ParameterFieldName == "MyName") {
field.CurrentValues.Add(MyDateValue);
}
}
|
|
|
|
|
Make sure you are using the right namespaces.
I have the following using statements in my sample
<br />
using CrystalDecisions.CrystalReports.Engine ;<br />
using CrystalDecisions.Shared ;<br />
using CrystalDecisions.Windows.Forms ;<br />
Also, make certain you are referencing the right assemblies. The following are ref's in my project
<br />
CrystalDecisions.CrystalReports.Engine<br />
CrystalDecisions.ReportSource<br />
CrystalDecisions.Shared<br />
CrystalDecisions.Windows.Forms<br />
The full path/classes are
<br />
CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
CrystalDecisions.Shared.ParameterField<br />
The sample I sent you works with Crystal Reports XI R2, but was the same in CR X.
|
|
|
|
|
Is this doable?
We're looking to develop an application that allows you to enter a domain (www.thewebsitename.com) and have the application return a list of all pages associated with that domain. (www.thewebsitename.com/allthesepages).
sanjeev
|
|
|
|
|
|
thanks for reply.......
can i have the pleasure to know how.....(please dont say that google has done it....... .coz i know that )
|
|
|
|
|
I don't usually hand feed people that ask broad questions, like can this be done. The solution is fairly simple if you think about the process(es) necessary to achieve this goal.
Start thinking of your problem from a broad view:
1 - I need to find a way to traverse through each page on a website.
Then break it down from there:
1.1 - Find methods I can use to traverse the site.
1.1.1 - retrieve the main page and traverse all on-site links
1.1.2 - find a method to find pages that are not linked to main site.
1.1.3 - ..... etc.
|
|
|
|
|
Strictly speaking, you can't.
What you can do is retrieve all of the pages that are linked to within the domain.
If there are no links to a page, then it won't get indexed.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
got some header file to some dll - its C++ i need convert it to C#, and it is a problem for me.
How i should write it in c#:
#define FAPI_NUMBER_LENGTH 32<br />
#define FAPI_FILE_LENGTH 128<br />
#define FAPI_NOTE_LENGTH 1024
and this:
typedef struct {<br />
int m_ConditionFlag;<br />
int m_Line;<br />
int m_CallTypeFlag;<br />
time_t m_FromDateTime;<br />
time_t m_ToDateTime;<br />
char m_RemoteNumber[FAPI_NUMBER_LENGTH];<br />
char m_LocalNumber[FAPI_NUMBER_LENGTH];<br />
char m_Note[FAPI_NOTE_LENGTH];<br />
int m_UserData;<br />
int m_Limit;<br />
int m_Offset;<br />
int m_OrderBy1;<br />
int m_OrderBy2;<br />
} FAPI_Condition;
Greetings
|
|
|
|
|
The translation is almost the same. The define should work fine, and for the struct; Just remove the typedef and make your srtuct without it.
about time_t members of the struct, pass it as long.
Regards
|
|
|
|
|
You can use the long (or int) and convert it to DateTime:
int t= 1070390676; // value of time_t
System.DateTime dt= new System.DateTime(1970,1,1).AddSeconds(t);
|
|
|
|