|
You can stop looking at mine. I wondered why there were fingerprints on the outside of the bedroom window.
|
|
|
|
|
Those aren't finger prints.
|
|
|
|
|
*Mind bleach* OK, I'm going to have to move house now.
|
|
|
|
|
with the RightToLeft option.
|
|
|
|
|
Your regex should actually look like this:
public static Regex regex = new Regex(
"(?:(?'Key'\\S+): (?'Value'.*?))",
RegexOptions.RightToLeft
| RegexOptions.CultureInvariant
| RegexOptions.Compiled
);
|
|
|
|
|
Ok, so how so I call it? This doesn't compile:
regex.Match(Line, expression);
I don't understand RegEx at all... It's all greek to me.
If it's not broken, fix it until it is
|
|
|
|
|
Sorry Kevin - you posted after I logged off for the night. Anyway, you don't want to use Match , you want to use Matches because you are returning a collection:
MatchCollection matches = regex.Matches(expression);
foreach (Match match in matches)
{
Console.WriteLine("Key: {0} - Value: {1}", match.Groups["Key"], match.Groups["Value"]);
} Basically, you have returned a collection of matches here. In the expression, you created two named capture groups so you need to reference the items by name by looking in the Groups property.
|
|
|
|
|
[EDIT] - Never mind. I'm stupid. I changed it to...
MatchCollection matches = regex.Matches(Line);
Now it works.
Thanks for the code. I'm still getting nothing in the collection. Here's my code:
var Line = "Dev: 0 Model: TOSHIBA MK3265GSX Serial: 20FDF20WS FW: GJ002H STW: 0 MaxLBA: 625142447 FDESUPPORTED: 0 PREBOOT: 0 DRIVETRUSTENABLED: 0 DRIVETRUSTSUPPORTED: 0 w128: 41 FULLFW: GJ002H SERVOFW: SDLSUPPORTED: 1 PLATFORM: 0 SAFE: 1 DSTTIMEOUT: 103 ISBOOTORSYSTEM: 1";
var WordToFind = "Model";
Regex regex = new Regex("(?:(?'Key'\\S+): (?'Value'.*?))",
RegexOptions.RightToLeft |
RegexOptions.CultureInvariant |
RegexOptions.Compiled);
MatchCollection matches = regex.Matches(WordToFind);
foreach (Match match in matches)
{
Console.WriteLine("Key: {0} - Value: {1}", match.Groups["Key"], match.Groups["Value"]);
}
I'm guessing the regex string is wrong, but kI really don't knnow.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: EDIT] - Never mind. I'm stupid. I changed it to...
MatchCollection matches = regex.Matches(Line);
OK, I was just about to point that out - good job.
|
|
|
|
|
Thanks for your help.
If it's not broken, fix it until it is
|
|
|
|
|
No problem. I'm glad we could help.
|
|
|
|
|
with the RightToLeft option it knows where the key ends and the previous value starts.
modified 19-Jun-12 18:44pm.
|
|
|
|
|
I want to programmatically create Excel charts in my c# application. Is there a way I can get the chart into a Panel control in my application? I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
|
|
|
|
|
Dan_K wrote: I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
A lot of those formula's are calculated at runtime, and are not exactly "inserted" in the physical file.
We got quite some articles on reading Excel-files and getting their content - check them out.
Bastard Programmer from Hell
|
|
|
|
|
Any links to resources that describe that? I will be very much happy with that.
|
|
|
|
|
On of the articles on the subject can be found here[^].
Bastard Programmer from Hell
|
|
|
|
|
Thanks Eddy, I think the charts are inserted in the worksheet. I don't know if there is a way to send only the chart into my application. Any way to do that?
|
|
|
|
|
What do you mean with "send into my application"?
Excel does not store a chart, but a description of a chart - one that's usually based on values within the same document. You can probably copy the contents to a bitmap and store that in your database.
Bastard Programmer from Hell
|
|
|
|
|
The short answer is no, there isn't any way to redirect the chart output to a control in your application.
The long answer is kind of, but it is so over the top complicated as to make it not worth the effort at all. Excel can provide data, but it's horrible at providing graphics.
The best solution is to just get a graphing library and setup the chart in your own application.
|
|
|
|
|
When you copy an Excel chart to the ClipBoard, it gets stored in the ClipBoard using a dozen different formats, including PNG, GIF, Bitmap, and EnhancedMetafile; which means any .NET app can retrieve it as an Image or Bitmap and work with that.
So start by using Office Interop (don't ask me for details, I don't know; Google and CodeProject do know) and have it copy the chart for you. Then write some code to paint the image where you need it.
|
|
|
|
|
I you intention is to display graphs/charts then you can achieve this by using the free library shipped with .Net 4.0. have look
Happy Coding
|
|
|
|
|
I need to write some linq to sql statments for sql server 2008 r2 database that accomplishes the following tasks in a C# 2010 .net application:
1. I need to delete one row from a table where the record I would be deleting is the key to the table called main.
2. I also need to delete records from an associated table (called sub) that has the key to the main table as one of its columns. This table called sub has no foreign key constraints setup as a requirement to the table called main. In the table called sub there can be from 1 to 500 occurences of the reference to the table called main.
3. I am not certain how to setup these two deletes? Would this be separate linqs statements? would I need two separate DeleteOnSubmit statements? Would I wrap the two delete statements into one transaction so that if there is a problem, I can rollback the changes?
Can you tell me and/or point me to a reference on how to complete this task?
|
|
|
|
|
Hi,
Basically I want to press a keyboard combination and have the screenshot sent via http to a server. During my research I was astounded of the complexity of even creating a keyboard shortcut which involved low level programming. Can you point my in the right direction in terms of libraries and technologies? To accomodate the workflow I want to be able to press the key combination anywhere from Windows and the application should then subsequently automatically send the picture via an HTTP POST request to a server.
Regards Anders
|
|
|
|
|
This[^] might help you getting the keyboard hook in place. In order to capture the screen, you might find this[^] helpful.
|
|
|
|
|
And finally you could use the WebRequest class to POST it to a server. Mind you, you probably will need some authentication to avoid the server being susceptible to all kinds of attacks...
There are several articles and tips around here that could help you, like maybe this one: Accessing the secured site using Webrequest[^]
|
|
|
|