Click here to Skip to main content
15,888,802 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWhat is the .Net equiv to this VB6 format statement Pin
Jon_Boy16-Jun-09 7:40
Jon_Boy16-Jun-09 7:40 
AnswerRe: What is the .Net equiv to this VB6 format statement Pin
The Man from U.N.C.L.E.16-Jun-09 7:42
The Man from U.N.C.L.E.16-Jun-09 7:42 
GeneralRe: What is the .Net equiv to this VB6 format statement Pin
Jon_Boy16-Jun-09 7:58
Jon_Boy16-Jun-09 7:58 
GeneralRe: What is the .Net equiv to this VB6 format statement Pin
The Man from U.N.C.L.E.16-Jun-09 8:04
The Man from U.N.C.L.E.16-Jun-09 8:04 
GeneralRe: What is the .Net equiv to this VB6 format statement Pin
Jon_Boy16-Jun-09 8:42
Jon_Boy16-Jun-09 8:42 
GeneralRe: What is the .Net equiv to this VB6 format statement Pin
Henry Minute16-Jun-09 8:50
Henry Minute16-Jun-09 8:50 
GeneralRe: What is the .Net equiv to this VB6 format statement Pin
Jon_Boy16-Jun-09 9:01
Jon_Boy16-Jun-09 9:01 
AnswerRe: What is the .Net equiv to this VB6 format statement Pin
The Man from U.N.C.L.E.16-Jun-09 22:40
The Man from U.N.C.L.E.16-Jun-09 22:40 
I have a much better solution, having slept on it. Use a System.ComponentModel.MaskedTextProvider. To make it easier wrap it up in a Class. e.g.

Public Class MaskFormater

    Private Sub New()
    End Sub

    Public Shared Function Format(ByVal input As String, ByVal mask As String) As String
        Dim maskProvider As New System.ComponentModel.MaskedTextProvider(mask)
        maskProvider.Add(input)
        Return maskProvider.ToDisplayString()
    End Function

End Class


This can then be used as follows:

'To get a @@-@@@@-@@
Dim h As String = "23snfg33"
Dim result As String = MaskFormater.Format(h, "aa-aaaa-aa")


For a list of available masking elements see the mask documentation on MSDN[^]">

If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk

GeneralRe: What is the .Net equiv to this VB6 format statement [modified] Pin
Jon_Boy17-Jun-09 6:05
Jon_Boy17-Jun-09 6:05 
QuestionForm Loading in VB .net [modified] Pin
No-e16-Jun-09 4:59
No-e16-Jun-09 4:59 
AnswerRe: Form Loading in VB .net [modified] Pin
dan!sh 16-Jun-09 5:34
professional dan!sh 16-Jun-09 5:34 
GeneralRe: Form Loading in VB .net Pin
Colin Angus Mackay16-Jun-09 5:43
Colin Angus Mackay16-Jun-09 5:43 
GeneralRe: Form Loading in VB .net Pin
dan!sh 16-Jun-09 5:50
professional dan!sh 16-Jun-09 5:50 
GeneralRe: Form Loading in VB .net Pin
No-e16-Jun-09 6:08
No-e16-Jun-09 6:08 
AnswerRe: Form Loading in VB .net Pin
Henry Minute16-Jun-09 6:41
Henry Minute16-Jun-09 6:41 
GeneralRe: Form Loading in VB .net Pin
No-e16-Jun-09 7:01
No-e16-Jun-09 7:01 
GeneralRe: Form Loading in VB .net Pin
Henry Minute16-Jun-09 7:06
Henry Minute16-Jun-09 7:06 
QuestionConvert a string to unicode Pin
mosche7516-Jun-09 4:17
mosche7516-Jun-09 4:17 
AnswerRe: Convert a string to unicode Pin
Luc Pattyn16-Jun-09 4:54
sitebuilderLuc Pattyn16-Jun-09 4:54 
GeneralRe: Convert a string to unicode Pin
mosche7516-Jun-09 19:45
mosche7516-Jun-09 19:45 
GeneralRe: Convert a string to unicode Pin
Luc Pattyn16-Jun-09 23:10
sitebuilderLuc Pattyn16-Jun-09 23:10 
Questionxml root Pin
Ebube16-Jun-09 2:43
Ebube16-Jun-09 2:43 
AnswerRe: xml root Pin
EliottA16-Jun-09 2:52
EliottA16-Jun-09 2:52 
GeneralRe: xml root Pin
Luc Pattyn16-Jun-09 3:49
sitebuilderLuc Pattyn16-Jun-09 3:49 
GeneralRe: xml root Pin
Ebube16-Jun-09 5:23
Ebube16-Jun-09 5:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.