473,765 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data in Masked Edit Text Boxes

16 New Member
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.
Mar 9 '09 #1
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.
Mar 9 '09 #2
mwcapps
16 New Member
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.
Mar 9 '09 #3
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.
Expand|Select|Wrap|Line Numbers
  1.         // Source Code starts
  2.         /*
  3.         <HowToCompile>
  4.         csc /r:System.Text.RegularExpressions.dll,System.dll Validation.cs 
  5.         </HowToComplie>
  6.         */
  7.         // Function to test for Positive Integers. 
  8.         public static bool IsNaturalNumber(String strNumber)
  9.         {
  10.             Regex objNotNaturalPattern = new Regex("[^0-9]");
  11.             Regex objNaturalPattern = new Regex("0*[1-9][0-9]*");
  12.             return !objNotNaturalPattern.IsMatch(strNumber) &&
  13.             objNaturalPattern.IsMatch(strNumber);
  14.         }
  15.  
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
Mar 9 '09 #4
Frinavale
9,735 Recognized Expert Moderator Expert
See here for an example....
Mar 9 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2466
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
2
13181
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
2
1805
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...
1
5511
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:
3
2611
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
7
8699
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!
8
1685
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 = "##:## ??"
4
2302
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...
2
3112
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
0
9568
marktang
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...
0
9404
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,...
0
10007
jinu1996
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...
1
9959
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,...
0
9835
tracyyun
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...
1
7379
isladogs
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...
0
5277
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...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.