|
Hi,
How can I validate the email Address in a textbox with multiple information. The same validation in yahoo when you add email add, if email add is not correct there is an error message.
Sample. dvd@yahoo.com; exevl@hotmail.com -- > correct (semicolon)<br />
dvd@yahoo.com exevl@hotmail.com -- > correct (space)<br />
James borlan [ James@yahoo.com] -- > incorrect<br />
james@yahoo.com Donald@yahoo.com [All email] - incorrect
Thanks
Dabuskol
Dabsukol
|
|
|
|
|
|
http://regexlib.com/Search.aspx?k=ip+address
code below matchs ip
string RegString = @"^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$";
Regex RegObj = new Regex(RegString);
if (!RegObj.IsMatch(ipString))
MessageBox.Show("error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
This will match the pattern of an email address using a regex expression:
public bool EmailValid(string email)
{
string _expression = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
@".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
return System.Text.RegularExpressions.Regex.IsMatch( email, _expression );
}
Hope this helps
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
|
Hi,
I have this code that makes the form as an MDIChild:
chartWindowController.GetForm().MdiParent =
_expertTradeMainFrm;
chartWindowController.GetForm().WindowState =
FormWindowState.Normal;
chartWindowController.GetForm().Show();
The above code snippet throws exception when Show() is called:
Message "Object reference not set to an instance of an object."
StackTrace " at System.Windows.Forms.ToolTip.CreateHandle()\r\n
at
System.Windows.Forms.ToolTip.get_Handle()\r\n at
System.Windows.Forms.ToolTip.WmWindowPosChanging(Message& m)\r\n at
System.Windows.Forms.ToolTip.WndProc(Message& msg)\r\n at
System.Windows.Forms.ToolTip.ToolTipNativeWindow.WndProc(Message& m)\r
\n
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32
msg, IntPtr wparam, IntPtr lparam)\r\n at
Microsoft.Win32.SafeNativeMethods.MessageBox(HandleRef hWnd, String
text,
String caption, Int32 type)\r\n at
System.Diagnostics.AssertWrapper.ShowMessageBoxAssert(String
stackTrace,
String message, String detailMessage)\r\n at
System.Diagnostics.DefaultTraceListener.Fail(String message, String
detailMessage)\r\n at
System.Diagnostics.DefaultTraceListener.Fail(String
message)\r\n at System.Diagnostics.TraceInternal.Fail(String
message)
\r\n
at System.Diagnostics.Debug.Fail(String message)\r\n at
CimsFramework.CimsSecurity.CmsUsrDataSheetSubModule.GetDataEntryInfo()
in
D:\\CIMS.NET\\CimsFramework\\CimsSecurity.cs:line 4127"
But when the same is not a MDIChild then it works fine i.e., if I
comment the line
chartWindowController.GetForm().MdiParent = _expertTradeMainFrm, then
the application works fine.
I have Visual Team Edition 2005 for Developers + Windows XP Sp2.
Can anyone let me know why this is happening or how to fix it. Thanks
in advance.
Regards
Sarang
|
|
|
|
|
first, make sure if one of the form-variables aren't null (expertTradeMainFrm maybe)....debug it
VirtualVoid.NET
|
|
|
|
|
I have a problem in undo & redo of custom controls...I have a custom control object that needs to be cloned into a new object when redo is done.
Am using the following method :-
In the below method "ctrl" is the New empty object to which the properties have to be copied from "propertyList"(Properties of Old object)..
But the following line throws an exception 'Unable to convert System.Reflection.RuntimePropertyInfo to System.Drawing.Point' when trying to copy AutoScrollOffset property.
lINE ->myProperty.SetValue(ctrl, obj );
Is there a way to convert a property(whatever be the type ) to the corresponding property in the new object ?????....
public static void SetControlProperties(System.Windows.Forms.Control ctrl,Hashtable propertyList)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(ctrl);
foreach (PropertyDescriptor myProperty in properties)
{
if(propertyList.Contains(myProperty.Name))
{
Object obj = propertyList[myProperty.Name];
myProperty.SetValue(ctrl, obj );
}
//...
}
}
|
|
|
|
|
Hello,
PropertyDescriptorCollection pdcoldControl = TypeDescriptor.GetProperties(oldControl);
PropertyDescriptorCollection pdcnewControl = TypeDescriptor.GetProperties(newControl);
foreach(PropertyDescriptor pdoldControl in pdcoldControl)
{
if((pdoldControl.Attributes.Contains(CategoryAttribute.Appearance) && pdoldControl.IsBrowsable)
|| (pdoldControl.Attributes.Contains(CategoryAttribute.Behavior) && pdoldControl.IsBrowsable && pdoldControl.IsReadOnly==false))
{
PropertyDescriptor pdnewControl = pdcnewControl[pdoldControl.Name];
pdnewControl.SetValue(newControl,pdoldControl.GetValue(oldControl));
}
}
TypeDescriptor.Refresh(oldControl);
TypeDescriptor.Refresh(newControl);
newControl.Size = oldControl.Size;
newControl.Text = oldControl.Text;
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi,
Thanks for ur help. I have implemented your method but with this method, i am not able to clone the object along with its member variables. In order to do that, i had inserted public properties for the member variables so that i could use the suggested method to copy these properties(indirectly copying the member variables also). But one of those members is of type XMLHandler, which is a custom serializable class to read values from an XML File. when i execute the system throws an exception 'System.XML.XMLElement is not marked as serializable'.
Please help me find a way to clone the object with its member variables or fix this exception.
|
|
|
|
|
Hello,
I think you have to try to cast the object with "ISerializable" class (best way is with the "as" operator) and than ask if its "!=null".
All the best,
Martin
|
|
|
|
|
How to make a listview looks like the windows explorer?
Just look the picture at
http://goldli.s75.53dns.com/desktop.jpg
the listview item can be splited by
http://goldli.s75.53dns.com/desktop1.jpg
or
http://goldli.s75.53dns.com/desktop2.jpg
if you can not see the pictures ,please send me a mail : goldli@tom.com
|
|
|
|
|
simply, add image list with some icons, create items there (by hand in listview tasks, or programatically), columns... and groups...
VirtualVoid.NET
|
|
|
|
|
Hi,
I want to restrict copy and paste the text in a TextBox control. The user should not copy the text from TextBox control and should not Paste any text into TextBox control. The user can enter any data and can delete. How can I do this in C#?
Thanks in Advance,
Reddy.
rr
|
|
|
|
|
Hi,
Pls see this link, this should help you out.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=741989&SiteID=1
Best regards
Omkar Ghaisas
|
|
|
|
|
Hi Reddy,
I couldn't restrict copy and paste in a textbox but colud restict copy and paste
on whole form.
here's the solution
add oncontextmenu="return false" to the body tag
Naveen G
MCSD.Net
|
|
|
|
|
Hi,
I was just wondering about how is Instantiating of a value type allowed in .NET
We know that Class is a Reference type and so we can create an object of it i.e its instances. But how is it possible for a Value type like int, Struct ?
When we type in int Counter = new int(); what does actually happen ?
Can anyone guide me. Pls correct me if I am wrong somewhere.
Thanks and best regards
Omkar Ghaisas
|
|
|
|
|
You don't need to use new with value types
only two letters away from being an asset
|
|
|
|
|
Hi,
I know that we don't use new on value types, but if we try to use that in actual editor, then it doesn't throw any error either. Then what exactly happens when we type in int Counter = new int();
Pls guide me.
Omkar Ghaisas
|
|
|
|
|
Please reade .Net FrameWork CareFully.
|
|
|
|
|
Mark Nischalke wrote: You don't need to use new with value types
How do you create a Point without new ? Point is a value type.
|
|
|
|
|
You're correct. I meant in the case he had; int somevalue = 0; would do, no need for new.
only two letters away from being an asset
|
|
|
|
|
|
I have just got the requirements to develop a project using .NET and c# codings. I have a good knowledge on database and UI. But i'm not able to understand the codes of C# very well... Can anyone tell me how to add C# files to ASP.NET, how to use methods and classes written in c# along with the business layer of ASP.NET.
|
|
|
|
|
HI
C# is a language. If you are using ASP.net then it can be done in many languages C# is one of them .............
Its very easy if you know C++ or java try to do some tutorials on C# and Google rest of the things Best Luck
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|