I have unformatted text in my SQL 2005 database. I'm pulling it into a masked edit text box with a (999)999-9999 mask. Unfortunately, when I attempt to save the data back it doesn't work because I don't know how to get the 'masked' information back to the 'unmasked' raw data that the database wants.
4 3174 tlhintoq 3,525
Recognized Expert Specialist
Strip out all characters that aren't a number. Either through Regular Expressions, or brute force checking each character in the string.
Is there any way that you can give me an example of how to accomplish either or both of those solutions. I really appreciate your help.
tlhintoq 3,525
Recognized Expert Specialist
I'm not a VB guy (C# spoken here).
But I can give you my C# function for checking if a string is a number, via RegEx. - // Source Code starts
-
/*
-
<HowToCompile>
-
csc /r:System.Text.RegularExpressions.dll,System.dll Validation.cs
-
</HowToComplie>
-
*/
-
// Function to test for Positive Integers.
-
public static bool IsNaturalNumber(String strNumber)
-
{
-
Regex objNotNaturalPattern = new Regex("[^0-9]");
-
Regex objNaturalPattern = new Regex("0*[1-9][0-9]*");
-
return !objNotNaturalPattern.IsMatch(strNumber) &&
-
objNaturalPattern.IsMatch(strNumber);
-
}
-
I send one character at a time of my entire string. The function returns true or false. If it is true, then I can add that one character to my final string. If not, I can ignore it
Frinavale 9,735
Recognized Expert Moderator Expert
See here for an example....
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rameshika |
last post by:
Hi All
How can I select a particular row in a datagrid.Where when the user double clicks the data in that row should appear in the corresponding text boxes in runtime
And how can the user insert,delete and edit fields in a datagrid at runtime
Please be kind enough to help me
Thanks
Rameshika
|
by: orekinbck |
last post by:
Hi There
I have spent alot of time trying to get a masked text box to validate
e-mails, but with no success. Mainly because I can't figure out how to
account for the wide variety of different e-mail addresses, for
example:
billwallis@hta.com
bill.wallis@hta.com
billwallis@hta.com.au
bill.wallis@hta.com.au
|
by: Gary |
last post by:
Hello All,
I have an editable data grid in my web form, this grid allows the user to
add new records, edit existing records and also delete them. When a user adds
a record the grid goes in to edit mode and four text boxes appear, one is for
the start date, another for an end date and the other two are for other data,
the user fills in the fields and saves the data, all is great at this point,
an entry is added ok. However the problem I...
|
by: metridevkk |
last post by:
Hi,
I need to use a Masked Edit Control in my ASPX page. In VS.Net, I added the
reference to MSMask.dll for my application & also added the MaskEdBox to the
Toolbox.
After adding the control to the web form, when I select the control & see
its properties, I do not see the "Text" property. I also try to set the
"Text" property in a javascript function, but cannot access it.
Here is the code:
|
by: Panos |
last post by:
Hi all,
I can't clear a Masked edit control. I use it to input dates, so I have
defined the mask as "##/##/####". I use the the well known
meb.mask=""
meb.text="" ,
but nothing happens.
Does anybody have a clue, why these lines don' t work? I use vb.net 2002
Thank u
| |
by: DazedAndConfused |
last post by:
Curently I manualy code keypress edits. i.e. allow only 3 digits before
decimal and two digits after decimal in .NET.
Is there an easy solution to mask text boxes?
The MSMASK32.OCX from vb6 does not seem to be appropriate for a desktop
application with textboxes not bound to a dataset, am I wrong?
--
How time fly's when you don't know what you are doing!
|
by: jamesburkett |
last post by:
I'm trying to clear text from a MaskEditBox control.
I thought the format to delete it was:
'clear the mask
mskName.Mask = ""
'clear the text
mskName.Text = ""
'reassign the mask
mskName.Mask = "##:## ??"
|
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ |
last post by:
I have created a report. This report needs to display records
between two dates entered by the user. I put two text boxes on the
report so I can enter the start and end date - I set them to use an
input mask of 'short date' format. The problem is that when I enter
anything in these text boxes, as soon as the field looses focus, the
text is cleared out - thus the text box is left blank. I have a button
on the form that calls the requery...
|
by: =?Utf-8?B?R3JlZw==?= |
last post by:
I'm from an Access background and I'm working with VB.Net.
In MS Access I can restrict data-entry into my fields on a form using the
Format property. Is there an equivilant in VB.Net. I want to restrict
data-entry into my text boxes to numeric only. 0-9 only. I don't want a
decimal place.
Thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |