For a newline in a windows console application in Visual Basic, try this:
Console.WriteLine("hello", vbLf)
The vbLf makes a so called "Newline".
سؤال
I have a textbox with multiline property. When verify the textbox, it will go through a function to check whether the value of each characters is in my allowed range. I have some value that have a newline such as below:
"Sorabee keeps your skin moisturizing last longer!
Description
Sorabee Skin Care series keep your skin moisture"
This is 3 sentences which has 3 newline. How to insert this newline in my checking as below:
Public Function AllowedChar(ByVal str As String) As Integer
Dim cnt As Integer
Dim allowChars As Char() = "1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm!+=-/., ?".ToCharArray()
Try
cnt = 0
For Each ch As Char In str ' to check whether special character exist in a string
If Array.IndexOf(allowChars, ch) = -1 Then
cnt = cnt + 1
End If
Next
Return cnt
Catch ex As Exception
strErrMsg = "Oops! Something is wrong with verify special characters at AllowedChar"
MessageBox.Show(strErrMsg & vbCrLf & "Err: " & ex.Message)
End Try
End Function
I can put a space to be verify. But how to put a newline as allowChars?
المحلول
For a newline in a windows console application in Visual Basic, try this:
Console.WriteLine("hello", vbLf)
The vbLf makes a so called "Newline".