Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 08, 2013 03:27 AM by novatgirl
Member
2 Points
18 Posts
Jan 08, 2013 02:38 AM|LINK
It does no detect "Verify"
when i type:
TextboxValidator. <<<<< intelisense only gives me "equals" and "referenceEquals", but i don't see Verify
also, i tried to chance "public class TextboxValidator" to "static public class TexboxValidator" and also no works,
i tried to put "using TextboxValidator in the file where i try to call the class and no works.
-------------------------
To make sure intelisense detect the methods, i put a TestMethod in the class and Intelisense detects the me Method when i create an instance
TextboxValidator myValidator = new TextboxValidator();
myValidator.TestMethod(); //>>>>>>>>>>>>>>>>>>>WORKS
using System; using System.Text.RegularExpressions; public class TextboxValidator { /// <summary> /// Test string using Regex.IsMatch static method. /// </summary> static bool Verify(string value) { return Regex.IsMatch(value, @"^[a-zA-Z0-9]*$"); } public void TestMethod( )
{ // this is for test intelisense } }
Star
13571 Points
2571 Posts
Jan 08, 2013 02:42 AM|LINK
The default access for a method is private. You need to make Verify public
public static bool Verify(string value)
Jan 08, 2013 02:58 AM|LINK
Works great!!! Thank you!!! now i can verify several Textboxes with the same class
Thanks again!!
---------------------------------------
using System; using System.Text.RegularExpressions; public class TextboxValidator { /// Test string using Regex.IsMatch static method. to check textboxes if users input text and numbers only public static bool Verify(string value) { return Regex.IsMatch(value, @"^[a-zA-Z0-9]*$"); } }
Jan 08, 2013 03:07 AM|LINK
This how i use the class from other files:
if (!TextboxValidator.Verify(TextBoxUsername.Text).Equals(true)) { Label1.Text = "symbols are not allowed *Please enter letters and numbers only"; Label1.Visible = true; }
no need create an instance to call "Verify"
Jan 08, 2013 03:09 AM|LINK
Get rid of the
.Equals(true)
it does nothing (apart from slow your code down)
Jan 08, 2013 03:24 AM|LINK
Ok, i will try,
thanks.
Jan 08, 2013 03:27 AM|LINK
Yes, you are right and make sense, since the method is bool, for default is true and no needs compare or Equals.
thanks again
novatgirl
Member
2 Points
18 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 02:38 AM|LINK
It does no detect "Verify"
when i type:
TextboxValidator. <<<<< intelisense only gives me "equals" and "referenceEquals", but i don't see Verify
also, i tried to chance "public class TextboxValidator" to "static public class TexboxValidator" and also no works,
i tried to put "using TextboxValidator in the file where i try to call the class and no works.
-------------------------
To make sure intelisense detect the methods, i put a TestMethod in the class and Intelisense detects the me Method when i create an instance
TextboxValidator myValidator = new TextboxValidator();
myValidator.TestMethod(); //>>>>>>>>>>>>>>>>>>>WORKS
using System;
using System.Text.RegularExpressions;
public class TextboxValidator
{
/// <summary>
/// Test string using Regex.IsMatch static method.
/// </summary>
static bool Verify(string value)
{
return Regex.IsMatch(value, @"^[a-zA-Z0-9]*$");
}
public void TestMethod( )
{
// this is for test intelisense
}
}
Paul Linton
Star
13571 Points
2571 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 02:42 AM|LINK
The default access for a method is private. You need to make Verify public
public static bool Verify(string value)
novatgirl
Member
2 Points
18 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 02:58 AM|LINK
Works great!!! Thank you!!!
now i can verify several Textboxes with the same class
Thanks again!!
---------------------------------------
using System;
using System.Text.RegularExpressions;
public class TextboxValidator
{
/// Test string using Regex.IsMatch static method. to check textboxes if users input text and numbers only
public static bool Verify(string value)
{
return Regex.IsMatch(value, @"^[a-zA-Z0-9]*$");
}
}
novatgirl
Member
2 Points
18 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 03:07 AM|LINK
This how i use the class from other files:
if (!TextboxValidator.Verify(TextBoxUsername.Text).Equals(true))
{
Label1.Text = "symbols are not allowed *Please enter letters and numbers only";
Label1.Visible = true;
}
no need create an instance to call "Verify"
Paul Linton
Star
13571 Points
2571 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 03:09 AM|LINK
Get rid of the
.Equals(true)
it does nothing (apart from slow your code down)
novatgirl
Member
2 Points
18 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 03:24 AM|LINK
Ok, i will try,
thanks.
novatgirl
Member
2 Points
18 Posts
Re: unable to Call a class from App_Code Folder
Jan 08, 2013 03:27 AM|LINK
Yes, you are right and make sense, since the method is bool, for default is true and no needs compare or Equals.
thanks again