.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to get text from Masked Text Box without the masked format while its empty

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Windows Application

Hi there,

   Im using a maskedtextbox with mask value of "000-00-0000" . If I try to get the text value of the maskedtextbox while its empty its returning "   -  -". I would like to get empty string wen no data entered.

Please do the needful ASAP.

Thanks in Advance,

Mark As Answer or Vote As Helpful if My Reply Does.

View Complete Post

More Related Resource Links

Masked Text box editing is difficult

I've implemented Matthew MacDonald's MaskedTextbox control, from his book, "Pro WPF in C# 2008".  It works fine, with one or 2 exceptions.  One of them is that when a user selects all of the contents in the textbox, they're used to hitting the delete key and that clearly everything out, so they can type over it.  For example, I've got a mask of "000000" for one of the boxes.  The users are used to selecting all 6 digits and then hitting the delete key and having that clear it out.  But this doesn't work that way.  Instead what they have to do is go to the end of the 6 digits and then hit the backspace kery 6 times.  That isn't anywhere near convenient as the old MaskTextBox in WinForms.  What can I do to make get this functionality back?Rod

Masked text box text alignment


Hi All,


I have an issue which smells like a culture issue, but I can't find any difference in the language/region settings.


I have a windows forms application using masked edit text boxes to display comma separated numbers. The boxes' RightToLeft property is set to 'Yes' and the TextAlign property is set to 'Left'. This is so that the mask is aligned to the right, and when focus moves to that edit box the cursor is at the far right and the number expands to the left as you type.


When I package the app up and deploy it, the mask is still aligned to the right, but the cursor goes to the left-most position, and the number expands to the right as you type.


This looks like an environment problem to me, but I can't see anything in the language and regional settings on my test box that's different from my development machines.


Any ideas?



How to make masked text box for TabletPC?.


hi Juhani,

I have a requirement like to create masked textboxes(Phone number with extension, zip,SSN)..I created them successfully..but if I ran my app on tablet PC and entering data with pen..then the mask and validation not working properly.

For ex: (___) ___-____ for this if I use pen and enter phone number i.e., 7324859000...in the masked textbox it is showing like this...   (7324859000___) ___-____.

Is there any chance to fix this. I am getting headache with this.

Please help me if you can.



SFTP is converting text file format, now SSIS sees an empty file


Using BIDS that came with SQL Server 2008 R2, I created a text file import package.  I used files generated from my local machine for local testing.  However, I find that these files get their format changed after being SFTP'd to the data warehouse.  Not being able to visually see a problem with the text file to be imported, I copied it down to my local machine and compared to one generated at my machine.  Not until I chose "Show All Characters" in Notepad++ did I see the difference: my local file ends its lines with a carriage return-linefeed character, whereas the file that went through SFTP ends its lines with a linefeed character only.

I suspect there's something very basic going on here that I don't know.  I won't ask anybody to explain it, but I'm wondering if there's some way I can import both file formats.  The column numbers and lengths are identical, it's the just line ending character that's different and causing zero rows to get imported.  The only other thing I know to do is recreate my flat file connection, and I haven't even tried that yet.


how to convert the text to mp3 speech format

im working on a applicatio that will speak out a text file for you. i have code to read a text file but can not directly convert and save in mp3 format.. need help.. :)

Need to convert query string(date - 09/15/2010) to a text format - yyyymmdd

I am fairly new to C # and need some assistance with a form page.  I have created a simple form that requires the user to select a beginning date and ending date.  I then pass the values to my code behind page via query strings.  I have them passing, but I need the format to be change to a different format.  Unfortunately the database does not use the standard date format.  It requires the date to be in a text format as YYYYMMDD.Form: <tr> <td> Beginning Date:</td> <td><asp:TextBox runat="server" ID="begDate"></asp:TextBox> <asp:Image ID="Image2" ImageUrl="~/images/calendar_schedulehs.png" runat="server" /></td> </tr> Code Behind: protected void createReport_Click(object sender, EventArgs e) { StringBuilder url = new StringBuilder("Report/TopCustomer.aspx?"); url.Append("BegDate=" + begDate.Text); url.Append("&EndDate=" + endDate.Text); url.Append("&Brnch=" + ddlLocation.SelectedValue); Response.Redirect(url.ToString()); Current URL: TopCustomer.aspx?BegDate=09/15/2010&EndDate=09/30/2010&Brnch=300I need to have the above URL change to:TopCustomer.aspx?BegDate=20100915&E

Reading WPF rich text box content in HTML format

Hi, I am using WPF RichTextBox. From that, I am reading the content in RTF format using the following code. TextRange textRange = new TextRange(paramRichTextBox.Document.ContentStart, paramRichTextBox.Document.ContentEnd); MemoryStream msData = new MemoryStream(); textRange.Save(msData, DataFormats.Rtf); //get the data from the selected range //strData = textRange.Text; strData = ASCIIEncoding.Default.GetString(msData.ToArray()); I also found that there is an option called DataFormats.HTML. Hence, I tried using this but ended up with error. Is there any other way to read the content of RichTextBox in HTML format? Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

Only show text from database if field is not empty

 Hoping someone can help. I am using ASP.NET VB and i am wondering how to only show text from database if data exists. I tried this but it does not work.Any help would be greatly appreciated.I am new to .NET, in the past i have always used classic asp. 1 <td valign="top" style="border-right: 2px solid #031992"> 2 (<%# Eval("VenderPhone1") %>) <%# Eval("VenderPhone2") %>- <%#Eval("VenderPhone3")%> 3 4 <% If String.IsNullOrEmpty(Trim("VenderAlt1").ToString) Then%> 5 <br />(<%#Eval("VenderAlt1")%>) <%# Eval("VenderAlt2") %>- <%#Eval("VenderAlt3")%> 6 <% End If%> 7 <% If String.IsNullOrEmpty(Trim("VenderFax1").ToString) Then%> 8 <br />(<%# Eval("VenderFax1") %>) <%# Eval("VenderFax2") %>- <%#Eval("VenderFax3")%> 9 <% End If%> 10 11 </td> 12   

How to convert .html format data to normal text using Regular Expressions?

How to convert .html format data to normal text using Regular Expressions?

Outlook & Absolute Links in Format Text Fileds


I have i news list with multiline text field in it.

When item is created an SPD WF brings it to every outlook inbox in company.

Body text includes list`s textfield.

Almost every time news has links to something inside intranet portal.

So my problem is that when people click link from outlook they get link like


And get error of course when opened in internet explorer. It should be absolute address like:


How can i force sharepoint absolute links?

How to align the text in justify format with SQL Server Reporting Services?



        How to align the text in justify format In SQL server Reporting Services? Is there any code to do so?

Content Editor text format functionality lost after deploying branding solution package


I've got two identical SharePoint 2010 servers.  One is a dev box and one is production.  We've got a branding solution package.  After deploying the package on the production server, when I go into edit a page, the text format functionality in the content editor works fine, i.e. I can change font, font size, font color, etc.  However, when I deploy the solution package on the dev server and then attempt to edit a page, the text format functionality is disabled/broken.  I can utilize bold, underline, or italicize but cannot change font, font color, font size, etc. 

I've copied a site collection from my production site (which works perfectly) over to the dev site with the same results, meaning once on the dev box, the copied site collection no longer has editing functionalilty in the content editor. Permissions are set the same on both boxes and as mentioned, editing works fine until deployment of the solution package on the dev box.   Any help would be greatly appreciated. 

Could Visual Studio installed on my Dev box cause this?


Loading rtf with image gives "Unrecognized structure in data format 'Rich Text Format'.\r\nParamet


I'm trying to load this rtf into a RichTextBox:

{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs18\f2\cf0 \cf0\ql{\f2 {\ltrch >> -----------------------------------------------------}{\ltrch \line }{\ltrch >> 19-10-2010 11:22}{\ltrch \line }{\ltrch >> -----------------------------------------------------}{\ltrch \line }\li0\ri0\sa0\sb0\fi0\ql\par}
{\f2 {\ltrch {\*\shppict{\pict\picwgoal1020\pichgoal1035\pngblip

Format a TEXT data type


I have a report that pulls data from a TEXT data type column.  When users type data into the database, hitting the ENTER key will start a new line.   When I pull the text onto a report it pulls all the text as one long string. The spaces are there but the ENTER gets ignored.  This makes the information hard to read.   Is there any way to read up the ENTER character and have the report format the text accordingly?  Or some other way to accomplish the same goal?


Can you custom format a single sitemapnode based it's text, url or level (submenu)?


The title pretty much states the question.  I have a menu inside my asp.net master page.  This menu pulls from  a web.sitemap file.  I have a css file that formats the individual nodes.  However, I want to format the menu headers a certain way while the submenu's are different.  Namely, I want to put a small image before all the submenu points while not the main sitemapnodes.  So far, I can use css to put the image infront of every node.  But I haven't been able to differentiate between the nodes.  The main node has a blank URL instance.  I thought I could use that in the C# code but I haven't been able to .  Could someone give me a link or show some code on how to do this?  Thanks.

Get Text Format and Encoding form WPF RichTextBox


Hi all.

I have a richtextbox in WPF. I type some text in it using blue color and some other format. Addtional, I write text in VietNamese language.

Now I want to transfer entirely plain text, its format and encode to other WPF Richtextbox.

I try it out, but not successful.

Anybody have the better ideas.

Thanks so much.




How to put a filter on a list based on the latest update on one particular multi-line text format co


Hi All,

In one of my lists, I have a column with multi-line text format that Appends Changes to Existing Text. I need to create a view that showes the 5 entity of this list whcih in those, my multi-text column is being modified most recently.

My first attempt was to create another column in the list with calculated format and use the formula section to modify it somehow to meet my goal, however as my desired column has multi-line text format, it seemd imposible.

By the way I am using Wss.3.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend