|
regex that allow only alphabets is below
^[a-zA-Z\S]+$.
You can validate the entered text in textbox by this.
Cheers!!
Brij
|
|
|
|
|
hello Brij
can u just show the code in 2 to 3 lines .....
|
|
|
|
|
|
Try handling the KeyDown event for the TextBox . If the character is one you don't want (a digit or punctuation for example), swallow it by setting e.Handled to true . That should work.
|
|
|
|
|
There's a bit more to this than you may think as you'll need to allow navigation and edit key combinations in your text box so just dropping the characters you don't want isn't enough. Also, you'll need to handle pasting of information to make sure it's valid.
I wrote an article[^] that does something similar - only numbers - but it can easily be adapted. It doesn't handle text that may be placed programatically, but a little checking in OnTextChanged would handle that.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
what is the C# equivalent of "atoi" in Visual C++?
thanks
|
|
|
|
|
PAsk the questions in Right forum.Put in C++ forum.
Cheers!!
Brij
|
|
|
|
|
int.Parse or Convert.ToInt32 . They will throw an exception if the string cannot be converted. int.TryParse won't throw an exception, and should be used if the string possible could not be valid.
|
|
|
|
|
But what if you have a string like "us dollars $34cheap". TryParse gives 0 for the result.
atoi would give 34.
Is there anything in C# that does exactly what atoi does in C++?
|
|
|
|
|
I don't know of anyting, but it wouldn't be hard to implement it yourself.
Just walk all the characters in the string, and copy the ones that are numbers to a temporal string, ignoring letters and symbols. Then int.TryParse that temporal string and you're done.
|
|
|
|
|
Hi,
I am using the App.Config file to store few mail settings including the static text that will be used to send the mail. All the key/value pair is working fine except for the static content pair where in I am not able to use HTML formatters to format the mail message. I am using the following statement:
--------------------------------------------------------------------------
<add key="MailStaticContent" value="Hi,<br><br>Please find attached your daily report.<br><br>Thanks,<br>Reporting System<br><br>Note: Do not reply to this auto-generated message. To send mail to the Coordinator, please use the application's 'Send Mail' link.";
--------------------------------------------------------------------------
I get the following message:
Application Configuration file "App.config" is invalid. hexadecimal value 0x3C, is an invalid attribute character. Line 21, position 44. <app_path>\App.config 21 44 <app_name>;
It is a mandate as per the design to use a HTML based mail and the values should be managed through the App.Config.
Any suggestions on how to rectify this issue?
|
|
|
|
|
you're putting tags inside XML. So, HTML encode them and decode them on the other end, or try using XHTML ( I don't think this will work, but you could try ).
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hello all,
I'm using a richTextBox for Converting html file to xml file.
How come that myRichTextBox doesn't respond to Undo/Redo functions by using
default shortcut keys, or even programaticaly (by using Button_onClick
event)?
if(richtxt.CanUndo == true)
{
richtxt.Undo();
}
After typing some text into richtxt, nothing happens when clicking the
button, or using Ctrl+Z... any idea?
please respond me??
|
|
|
|
|
Does the crystal reports developed in WindowsXP worked in Vista or not?
|
|
|
|
|
I'm almost compelled to shout that it doesn't work and won't ever work!
..humor aside, why wouldn't it work? Microsoft spends a lot of money in making sure that the most popular applications keep working when you upgrade. (Be that from W2k to XP or XP to Vista)
I are troll
|
|
|
|
|
how can I write something like this? Is it possible at all?
<br />
IPanel panel;<br />
IDataGrid grid;<br />
switch(AppDomain.CurrentDomain.ApplicationType) {<br />
case ApplicationType.WinForm:<br />
grid = new System.Windows.Forms.DataGridView(...);<br />
case ApplicationType.ASPNET:<br />
grid = new System.Web.UI.WebControls.GridView(...);<br />
case ApplicationType.WPF:<br />
grid = new ???<br />
<br />
panel = findPanel("panel1");<br />
panel.add(grid, 0, 0);<br />
<br />
foreach(DataRow row in grid.Rows)<br />
{<br />
}<br />
I am contemplating possibility of writing a GUI generator... there's no such thing as ApplicationType.ASPNET? or is there?
Thanks
dev
|
|
|
|
|
No, there isn't, but I'm sure you could detect that you're running as the ASP.NET user, or within IIS. Or just work out if you're importing the winforms namespaces, the web namesspaces or the WPF namespaces ( or, at least, using objects from them )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
how can i disable and then enable
explore.exe
|
|
|
|
|
Since it's not a service, you can't. Also, it provides the shell, so why would you want to do this?
|
|
|
|
|
thank you
i want make program lock xp
so the program must disable explorer.exe in order the user can not make any thing
until entered password and user name
|
|
|
|
|
*Repost*, additional hints removed.
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2861463
I are troll
modified on Friday, January 2, 2009 8:17 AM
|
|
|
|
|
You cannot just disable Explorer and expect to just reenable it. It just doesn't work that way.
Your asked this question back on 12/27 and were given the only answer that is going to accomplish what you described.
Your app cannot completely lock Windows the way LockWorkstation does because your app is a user-mode application that can easily be defeated.
|
|
|
|
|
You cannot disable a process per say.
One thing you can do is suspend a thread.
So can enumerate all the running processes.
In each of them you can enumerate all running threads and then suspend each one of them.
I wouldn't do this if I were you.
There should be a better way to do what you want to do.
« Superman »
|
|
|
|
|
Hi,
I need help to access the files on my digital camera.
I have tryed to access it with
String path;
Shell32.ShellClass shell = new Shell32.ShellClass();
Shell32.Folder2 folder = (Shell32.Folder2)shell.BrowseForFolder(
this.Handle.ToInt32(),
"Select Folder...",
0,
Shell32.ShellSpecialFolderConstants.ssfDESKTOP
);
path = folder.Self.Path;
path = ";;{E211B736-43FD-11D1-9EFB-0000F8757FCD}\\devid:{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\\0000:"
Unfortunately this path is not accessable with
String [] files = Directory.GetFiles(path);
Any idea how to access the files?
|
|
|
|
|
Hi,
what is all this?
when I want to access image files on my Olympus, I just explore I:\DCIM\100OLYMP\
either with Windows Explorer or with my own code as in Directory.GetFiles(@"I:\DCIM\100OLYMP\"); .
Obviously the drive letter may vary, and the specific folder path may be different for other makes and models.
[ADDED]
If you don't know the drive letter, you can enumerate all candidates using Environment.GetLogicalDrives and try the Directory.GetFiles for each of them (assuming the path is unique).
[/ADDED]
|
|
|
|