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


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

Recommended Answers

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

Jump to Post

All 4 Replies

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.
        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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.