|
i have a question about strings, for example if i have line like that:
Dialogue: 0,0:00:33.36,0:00:36.61,Default,,0000,0000,0000,,{\k63}hora {\k54}omou {\k51}ijou {\k34}ni {\k48}tondemo {\k75}nai
and i want to get all values near the "\k", in other words, it's will return me 63, 54, 51, 34, etc.
thanks for help.
|
|
|
|
|
string test = @"Dialogue: 0,0:00:33.36,0:00:36.61,Default,,0000,0000,0000,,{\k63}hora {\k54}omou {\k51}ijou {\k34}ni {\k48}tondemo {\k75}nai";
string regex = @"\{\\k(\d+)\}";
foreach (Match match in Regex.Matches(test, regex))
{
Console.WriteLine(match.Groups[1].Value);
}
[modification]You'll need to import System.Text.RegularExpressions in your source file (or type the full name for RegularExpression classes)[/modification]
Ed
|
|
|
|
|
Please excuse me if this is an 'obvious' or 'trivial' question . . . I'm a C# newbie . . . familiar with VB5 (learning VB.NET and C#.NET), but this .NET arena is quite different
I would like to write a C# applet which hides in the background and watches for the common Windows "File Open" (or "File SaveAs") dialog to open-up (from any application running on the system), and then attach a couple of icons to the title-bar which would do actions that I'm going to code-up.
Specifically, there's an old, unsupported piece of software called "PowerDesk Dialog Helper" (which worked great pre-XP, but is mostly-broken with modern apps) which would put a "Recent Files" and "Recent Folders" icon on the title-bar (the lists being unique to the application which launched the dialog) so that you could easily navigate to places where you'd been with that application. I'd like to recreate this behavior, and embellish upon it.
Any suggestions on how to make my applet (probably hide in the 'tray') take-notice of a newly-opened "File SaveAs" or "File Open" dialog box, and then attach a pair of icons to it's title-bar??
Thanx (in advance).
Saber Of Borg
|
|
|
|
|
Please excuse me if this is an 'obvious' or 'trivial' question . . . I'm a C# newbie . . . familiar with VB5 (learning VB.NET and C#.NET), but this .NET arena is quite different
I would like to trigger an event when a window or dialog opens-up anywhere in the Windows environment. I wish my C# applet to take some action (specifically, to pop that window/dialog to the foreground of all other open windows) when it senses that a window/dialog has just appeared-on-the-scene; I don't want to trigger when a user merely "Restore"s (i.e. un-minimizes) an already-open application. I'm trying to write a 'tray' applet which watches for the Outlook2003 "Reminder" dialog (which often pops-up BEHIND open applications, thus not waking-me-up for my appointments ;-O ) and forcing it to the foregound . . . and possibly playing a 'sound' to get my attention.
Any pointers on how to do that, or which keywords I should be using in searches? I've tried "trigger window open" (and similar words), but haven't stumbled upon anything useful yet.
Thanx (in advance).
Saber Of Borg
|
|
|
|
|
How about using Form.Activate() method.
|
|
|
|
|
This might possibly help me raise a form to the front once I know that a particular form needs to be brought to the front, but, I don't see now this will wake-up my application when some other application window has just opened. Please elaborate . . .
Thanx.
Saber Of Borg
|
|
|
|
|
In Outlook, Tools - Options - Other tab - Adcanved Options button, Reminder Options button...
If there was any example of a convoluted and misleading Options dialog, where you couldn't find anything you wanted, Outlook is it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, I know . . . and the dialogs change with each version of Outlook . . . the old Outlook 2000 on Win2k seemed to work fine . . . always seemed to pop-up when it should . . . at home my Outlook 2002 on WinXPhome seems to work fine . . . always seems to pop-up when it should . . . the problem I'm having is with Outlook 2003 on WinXPpro . . . about half the time it pops-up behind the other open windows. And, YES, I have the option set that is supposed to force it to the front . . . but it still doesn't. I've tried un-setting the option, saving, then resetting the option, saving . . . thinking perhaps the registry entry where that is stored just needed a swift kick in the rump . . . no help.
So, since their stupid s/w can't seem to get-the-hint I thought I'd write a background task that would take charge and do it for Mr Gate's Banta fodder. Plus, I use a math analysis tool called Mathcad which, when you launch it, is too dumb to pop to the front despite the fact that it opens "Maximized" . . . so, if figured I'd flush 2 turds with one stone
So, that being the case . . . any ideas how my VC# program can wake-up when a window or dialog (from another app) has just appeared??
TIA
Saber Of Borg
|
|
|
|
|
Hi!
You either poll the current windows (P/invoking EnumWindows ) for a file dialog window (you can use Spy++ to find out the correct window class names), but that's not very elegant.
Or you create a system-wide hook to inform you application that a special window has appeared - I think CTBHOOKs can monitor the creation of windows.
The problem is that hook procedures in C# will not work in every case (injecting managed code into an unmanaged application can become a little tricky ), but since the hook procedure only has to inform you that a special window has appeared and perhaps transmit the HWND of this window, it should be possible to put together the proc in C++ by adapting one of the samples flowing around the net.
HTH,
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Saber Of Borg wrote: So, since their stupid s/w can't seem to get-the-hint I thought I'd write a background task that would take charge and do it for Mr Gate's Banta fodder.
I've never had a problem with it not popping up. My fiancee has also never had a problem with that stupid reminder thing never popping up in front.
Saber Of Borg wrote: Plus, I use a math analysis tool called Mathcad which, when you launch it, is too dumb to pop to the front despite the fact that it opens "Maximized"
It sounds more like you've got a problem with the system, or some other "tool", than these two applications. Perhaps something installed with the video driver?? I know ATI and NVidia has packaged some new toys in their driver packages. Or possibly some other tool that screws with Windows.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Do you and your fiancee use Outlook 2003 on WinXPpro? The Outlook reminders worked fine in Outlook 2000 on Win2k . . . and it works fine on my home system (Outlook 2002 on WinXPhome). I suspect that they changed (broke) something in Outlook 2003.
Mathcad never popped to the front at work . . . Win2k or WinXPpro . . . but it does at home on WinXPhome. Perhaps there's something going-on with NOT being an Admin (aka SuperUser) at work?
Regardless, it still sounds like an interesting learning experience to be able to do what I want to do
Saber Of Borg
|
|
|
|
|
Hi,
I have a toolbar on a windows client form. The toolbar contains a mix of icons and icons + text styled buttons. However, the toolbar seems to resize all buttons to the widest button.
How can I make the toolbar buttons different widths?
I guess I'm trying to get something similar to the IE toolbar where you have buttons like the Home (icon only) and the Search (icon + text).
Any help/advice is much appreciated
Thanks
Peter
|
|
|
|
|
You should be able to disable the AutoSize property of each button. At least you can in a ToolStrip . See this[^] screenshot for example.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks, but no luck there. The AutSize property is only for the Toolbar control only and not available for each button.
|
|
|
|
|
|
Hi,
I'm using WinXP SP2. Now, I want to use C# to control (turn on/off) the services (ex: Telnet, Telephony, Themes....) in WinXP!
Thanks much,
Hung.
Hung
|
|
|
|
|
|
Hello!
Doing some C# and trying to access my db.
Following a book from Wrox, they use VB - there is my problem.
How would I translate the following to C# ?
Dim PKvalue As String = FilterInput.Text; // Filterinput är en textbox
DIM Rowlocated AS DataRow = Me.MyDBDataSet.Person.Rows.Find(CType(PKvalue,Integer))
If Not ( RowLocated Is Nothing) Then
MessageBox.Show(CType(Rowlocated(1),String))
Else
MessageBox.Show(PKvalue & " record not located" )
End if
I tried out the Converter from VB to C# : http://www.developerfusion.co.uk/Utilities/convertvbtocsharp.aspx
But that did not help me, do not Quite understand the Rowlocated variable that is
an instance from DataRow.
Hopefully you are able to help me.
regards, i
"But if thought corrupts language, language can also corrupt thought." -George Orwell
|
|
|
|
|
string PKvalue = FilterInput.Text; // Filterinput är en textbox
DataRow Rowlocated = Me.MyDBDataSet.Person.Rows.Find(CType(PKvalue,Integer));
if (! RowLocated == null)
{
MessageBox.Show(CType(Rowlocated(1),String));
}
else{
MessageBox.Show(PKvalue + " record not located");
}
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I don't think that is an accurate translation.
This might be better
string PKvalue = FilterInput.Text;
DataRow Rowlocated = this.MyDBDataSet.Person.Rows.Find(Int32.Parse(PKvalue));
if (! RowLocated == null)
{
MessageBox.Show((string)Rowlocated[1]);
}
else{
MessageBox.Show(PKvalue + " record not located");
}
Me == this
CType is a casting operator of some sort (more of a black box that C#'s casting operator as it can do string to int translations also)
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Instant C# produces:
string PKvalue = FilterInput.Text; // Filterinput är en textbox
DataRow Rowlocated = this.MyDBDataSet.Person.Rows.Find(System.Convert.ToInt32(PKvalue));
if (Rowlocated != null)
MessageBox.Show(System.Convert.ToString(Rowlocated[1]));
else
MessageBox.Show(PKvalue + " record not located");
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
Hi to you All!
Well the converter I tried gave this result:
string PKvalue = FilterInput.Text;
DataRow Rowlocated = this.MyDBDataSet.Person.Rows.Find(((int)(PKvalue)));
if (!((RowLocated == null))) {
MessageBox.Show(((string)(Rowlocated(1))));
} else {
MessageBox.Show(PKvalue + " record not located");
}
|
|
|
|
|
I have a figure in a winform, a rectangle, and a NumericUpDown, its miniumum and maximun values are 0 and 100, i want that when i increase the NumericUpDown value the rectangle must change its color, for example when the value is 0 the rectangle color must be black and when i increase the value the rectangle color must turning into white, when the value is 100 the rectangle color must be completely white.
I have seen some examples using LinearGradientBrush but i don't know exactly how to do that, somebody knows how could i do this?
Regards,
Alberto Martinez
|
|
|
|
|
If you want a solid colour which it looks like you do then you should use SolidBrush.
In the Change / Click event of the NumericUpDown invalidate the region where you're drawing the rectangle.
In the paint event handler do something like:
using (SolidBrush brush = new SolidBrush((byte)(numericUpDown.Value * (100 / 255))...
{
graphics.FillRectangle(...)
}
basically you need to scale 0-100 up to 0-255 for each red, green and blue component of the colour.
Regards Ed
|
|
|
|
|
Sorry to interrupt, but the code above will not work.
If your write (100 / 255) you'll get integer division resulting in 0, so the value of the numericUpDown won't have an effect for the color of the brush.
Besides, to get values between 0 and 255 you'll have to reverse the fraction.
So something like (int)(numericUpDown.Value*255/100) should work better.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|