2016-03-21 21 views
0

O tam 9 basamak/karakterleri olmalıdırkontrol o zaman

if abc.text = (some 9 digits/characeters) then 

Endif 

gibi bir şey ... o zaman sadece if ifadesi gider

Herhangi Fikir var mı ?? ?

If abc.Text.Length = 9 Then 
    'ToDo 
EndIf 
+6

'abc.Text.Length = 9' –

+0

bunu upvote böylece Ah, teşekkürler, cevap yazma .... @NicoSchertler –

cevap

3

kontrol edebilirsiniz

: reqular ifadesini

Dim objRegExp As New System.Text.RegularExpressions.Regex("^[a-zA-Z0-9]{9}$") 
If objRegExp.Match(abc).Success 

End If 

ithal etmek unutma etmeyin kullanmak

Imports System.Text.RegularExpressions 
1

Eğer sadece sayı veya karakter contraint istiyorsanız sadece Ancak boyu bize

If abc.text.Lenght = 9 Then 

End IF 

kontrol etmek isterseniz: En dize uzunluğu 9 eşitse

0
Module Module1 

Sub Main() 
    Dim x As String = Console.ReadLine() 
    If (x.Length = 9) Then 
     Console.WriteLine("We have nine character") 
    Else 
     Console.WriteLine("we have {0} character .", x.Length) 
    End If 
    Console.ReadKey() 
End Sub 

sonu Modülü

İlgili konular