I have a textbox2.text and I declare this as a string namely myletters
and I also have a label36.text and i also declare this as a string namely patterns
I will only input on the textbox is letters from "a" to "z" only and the reason why there is a label36 is that when i put the same letter again it will show an error message.
This is my code so far.
-----------------------------------------------------------------------------------------
Imports System.Text.RegularExpressions
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim patterns As String
patterns = Label36.Text
Dim myletters As String
myletters = TextBox2.Text
Dim matches As MatchCollection = Regex.Matches(myletters, patterns)
If Regex.IsMatch(patterns, myletters) Then
MsgBox("You already typed this letter.")
Else
Label36.Text = Label36.Text + myletters + ","
End If
End Sub
----------------------------------------------------------------------------------------
What use on the top is my code so far that will show error if i already put a same letter again and give this if i dont put the same letters.
Example Output:
Set A: a,b,c,d,e
Now here is my questions.
1.How can i input my first letter without following a comma?
Example:
a
But my output is
Example:
a,
2.How can i set my textbox to the maximum of input of just 1 letter?
3.How can i put commas in right time and format?
Example 1:
a
Example 2:
a,b
But my example is
Example 1:
a,
Example 2:
a,b,
4.How can i arrange the alphabet letters in the right positions?
Example 1:
a,z
If i will input "x" the output must be
Example 2:
a,x,z
Thank you, any answer will be accepted TY.
[edit]SHOUTING removed - OriginalGriff[/edit]