Hi Y'all,

I have a RTB which I import with a set of 7 or 9 didit numbers, 7 for Staff and 9 for Students. e.g. Staff numbers

0628189
0628191
0629991
0629850
0804930

and depending on what is selected in a list box ('Student' or 'Staff') will generate a string to create user accounts. To further error check I would like to check if a line in the RTB = 7 And Listbox = "Student" Then msgbox("Data mismatch between User ID and Account type") Else .....

many thanks in advance

How do you plan to:>>check if a line in the RTB = 7
.Button.Click?, rtb.Click?, waving your hand?

LOL sorry about that, Button click

Then a Button.Click shall be.:)

Public Class Form1
  
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        MsgBox("rtb is accurate = " & validateCoolRTB(RichTextBox1, 7))
    End Sub
    Private Function validateCoolRTB(ByVal selCoolRTB As RichTextBox, ByVal iIDlengthThatIsAlsoCooLxD As Integer) As Boolean
        For Each itm As String In selCoolRTB.Lines '// loop thru lines.
            If Not itm.Length = iIDlengthThatIsAlsoCooLxD Then Return False '// get.lenght of line and If Not accurate, Return False.
        Next
        Return True '// If all checks out OK, Then Return True.:)
    End Function
End Class

Wow cheers, works brill, little bit playing on my behalf shall see it all working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.