Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friendsa , i am creating a search page in
here user will enter bill no in multile textbox (line by line ,one bill in one line)
this is my code .it ias working fine for comma seprated values.
but i want to use all values line by line .
how can i do it.
Thanks in Advance friends

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim strArr() As String
        Dim itemcount As Integer
        Dim count As Integer
        Dim str As String = txtBillNo.Text
        Dim forlabel As String
        strArr = str.Split(',')
        For itemcount = 0 To strArr.Length - 1
            superTypeObj.PSearchText = strArr(itemcount)
            dsdata = superTypeObj.SearchCourierByBillno
            Dim row As DataRow = dsdata.Tables(0).Rows(0)
            count = dsSearch.Tables(0).Rows.Count
            If count <> 0 Then
                row = dsdata.Tables(0).Rows(0)
                forlabel += strArr(itemcount) & ", " & ""
            End If


        'superTypeObj.PSearchText = txtBillNo.Text

        ' dsSearch = superTypeObj.SearchCourierByBillno

        count = dsSearch.Tables(0).Rows.Count

        If count > 0 Then
            If count <= 15 Then
                Dg.PagerStyle.Visible = False
            End If
            Dg.DataSource = dsSearch
            lblMsg.Text = "following" & forlabel & " Waybillnos are not correct "
            Dg.Visible = "False"

            lblMsg.Text = "following" & forlabel & " Waybillnos are not correct "
        End If
    End Sub
Updated 8-Jun-11 22:01pm

Use str.Split(vbCrLf) for splitting multiline text.
Share this answer
Sergey Alexandrovich Kryukov 9-Jun-11 4:25am    
My 4. I added to improvements to your solution to make it complete.
Please see mine.
In addition to the solution by Prerak:

For compatibility, you really should use System.Environment.NewLine for delimiter. Very often it useful to use System.StringSplitOptions.RemoveEmptyEntries, see[^] for a code sample.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900