|
hey to all,
i am trying to parse a source file to determine the class name from its signature using regex
i can get it as long as the file doesnt include anything after the '{' in the signature,
can anyone offer help pls?
[code]
Regex regex = new Regex(@"(?<=\bclass\s+\b)\w+(?=\s*\{)");
this works fine for examples like:
// this is class file
public class Tester
{
}
internal class InternalTester{
}
// output misses commented 'class' keyword, this is good
[/code]
but if i have say a java example or if i extend a class it fails
like:
[code]
public class Form1 : System.Windows.Forms.Form
{
}
// or java
public class Listener extends Thread
{
[/code]
also i would like to be able to change the keyword it is trying to find with something this (which is wrong)
[code]
static string KEYWORD = "class";
Regex regex = new Regex(@"(?<=\b" + KEYWORD + "\s+\b)\w+(?=\s*\{)");
[/code]
any suggestions pls ?
kind regards
maurice
|
|
|
|
|
Doesn't answer your question but it may help
Regulator[^]
|
|
|
|
|
I am trying to escape quotations in the following scenario:
I have a string variable, and text that I need to pass to a system command. But I need to include quotes IN one of the elements of the system command.
string gar = "Variable";
string subject = gar + "Here is some more text";
System.Diagnostics.Process.Start("command.bat" + gar);
The kicker for me is that the subject MUST include quotes (") around the entire variable to the command line like this:
c:\command.bat "Variable Here is some more text"
Any ideas ?
--
sween
|
|
|
|
|
How about this:
string subject = "\"" + gar + "Here is some more text\"";
www.troschuetz.de
|
|
|
|
|
|
I need to programatically bring up the Windows logon dialog. I don't want to find any usernames or passwords, just force the user to re-enter his credentials - this is to prevent unauthorised users from changing settings in the application if the authorised user has walked away from his desk for a few minutes.
There must be a simple c# method that does this!
|
|
|
|
|
Actually, I think you want to enable the screen saver and make sure that it is asking for a password to unlock. You can't force the Windows Login to show up again just to authenticate.
If your application times out and locks itself, you have to put up your own form to capture credentials, then you can pass those to something like Active Directory to authenticate.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks, OK, but is there a way to force the screensaver to come up immediately? I just want to ensure that, when someone presses a 'save' button that changes a database, they immediately get a request for credentials.
I don't want to create a new form to capture credentials since there is no way to check the Windows NT password.
|
|
|
|
|
using System.Diagnostics
Process.Start("scrnsave.scr");
|
|
|
|
|
using System;
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern void LockWorkStation();
LockWorkStation();
|
|
|
|
|
Hi,
im fiddling around a bit with a repeater for win forms
and just wanted to see if there is a need for such component or if its just plain stupid :P
the idea is pretty much to make it somewhat like an editeble report.
and let users edit data in a gui that actually look like something rather than just tabular data as in normal grids
and also , any feature suggestions?
http://www.compona.com/winrepeater.gif[^]
//Roger
|
|
|
|
|
Hello,
I am self learning C# (visual C#) and I am doing some basic project. I just need some help in how I should code this program. I kind of thought through it, but i am trully not doing good. Just to keep moving, I thought I would ask for help in here. Here it is:
Write a program that will implement a Complex class and a simple Main program that will demonstrates the use this class.
You must create two classes. Complex stores its real part and imaginary part. Add a few constructors to allow statements like these ones:
Complex plxZ;
Complex plxX = new Complex (4.5, 6.0);
Complex plxY = new Complex (plxX);
Add five operators (+ - * / ^) to allow statements like these ones:
plxZ = plxX + plxY;
plxZ = plxX ^ 7;
Override the ToString() method to allow statements like these ones:
tbOutSum.Text = plxZ.ToString ();
Create a simple Main class to use Complex. This should allow the user to enter complex numbers and an integer, and then demonstrate the five operations on these numbers.
I will trully appreciate any help on this matter,
Thank you in advance,
A Newbie In Tha Block
|
|
|
|
|
What are your concrete problems? Where are you stuck?
Just providing your task gives the impression that you want us to write the whole code for you, but i don't think this is the case here.?
www.troschuetz.de
|
|
|
|
|
Hello,
how can i add c# application on windows start up.
i dont want to add in start up folder.Is there any othere
way? like yahoo messanger which is not appeared in start up
folder..
|
|
|
|
|
Put a value for it in one of the following folders.
For All users:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
For the current users:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
|
|
|
|
|
How can i add this from c# application?any example
|
|
|
|
|
using Microsoft.Win32;
.....
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey run = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentUser\\Run");
run.SetValue("MySoftware", "C:\\Path\\To\\Software.exe");
something like that should do the trick.
|
|
|
|
|
using Microsoft.Win32;
string strAssemblyPath;
strAssemblyPath = System.IO.Path.GetDirectoryName(base.Context.Parameters[ASSEMBLYPATH_STATENAME]);
Process.Start(strAssemblyPath+"\\Application.exe");
RegistryKey MainKey;
MainKey=Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths");
RegistryKey ApplicationKey=MainKey.OpenSubKey("Application",true);
ApplicationKey.SetValue("Application.exe",strAssemblyPath+"\\Application.exe");
Check the Above code written in c#. This Code i have written for writting my application path into registry.
And u can add the application to the Start up in another way also.
Check while creating setup u can create a chort cut to the start menu startup folder. that will also run the application.
Arun Kumar Sabat
|
|
|
|
|
Thanks for your replay.
i have another doubt?
how can i hold system shut down process
until user close my c# application properly...
|
|
|
|
|
Hi,
I have two datagrids on a WinForm. I want to keep them synchronized so that when the user scrolls one of them, I can programmatically scroll the other one an equal amount. The datagrid is new to me. How can I do that?
Royce
|
|
|
|
|
If you had searched for answers to your problem first, you may have run across http://www.codeproject.com/script/comments/forums.asp?msg=911474&forumid=1649#xx911474xx[^], which describes the solution to what you're searching for. The fact that this is for a RichTextBox doesn't matter; the same solution works for practically all scrollable controls so long as the controls that they encapsulate handle the standard scrolling messages.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi,
I'm using C#Express Beta and accordingly the framework 2.0.
I recently realized that my application, when starting has a workingset peak of ~128 MB. I startet wondering a bit because the application didn't yet do anything really usefull.
So I fired up the IDE, created an empty WinForms project and compiled a release build. Please note that I have not added any extra code! Here is what I have figured out:
1. On launching the resulting exe, the TaskManager shows a workingset of ~70 MB.
2. When I minimize the MainForm window the workingset shrinks to ~400 KB.
3. Maximizing the window again results in a workingset of ~1460 KB, which I could live with.
Does anyone have an idea how to go on about this?
BTW.: Is there a way to monitor in detail what and where and how your application is using up the memory? I have a monitor to get information as of what modules are loaded, but is ther a way to figure out of what classes or resources are taking up the space?
Any pointers are highly appreceated.
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
|
|
|
|
|
|
Thanks for your reply. I've downloaded the tool and am now trying to figure out if and how it could help me
Thanks again!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
|
|
|
|
|
Hi,
How can I use this command in C# ?
Inet.Execute "http://200.100.100.100/econtrol.html", "POST", "P1=t"
Best Regrads
youssef
|
|
|
|