none
help me achive this comple logic(datatable.select) RRS feed

  • Question

  • Dear friend

    s() as string={"11111:111","90900:111","11111:222","8888:222","7777:222","4444:333"}
    i have two comboboxes in my form. say X and Y
    in X combobox i have values like this;
    111,222,333

    so my need is if i choose 111 from my X combobox,the relative values in above array has to be filled like the follows

    my Y combobox has to show this values.
    11111
    90900

    so my need is if i choose 222from my X combobox,the relative values in above array has to be filled like the follows

    my Y combobox has to show this values.
    11111
    8888
    7777

    like this i need to do.so i tried  as follows

    Private arrValues() As String = {"1111;111", "12333;111", "32222;222", "43555;222", "99999:333", "10000:333"}

        Public Function FindData(ByVal searchText As String) As System.Collections.Specialized.StringCollection

            'create table to hold x and y values

            Dim myData As New DataTable

            myData.Columns.Add("x")

            'myData.Columns.Add("y")

            With myData.Rows
                .Add(arrValues(0))

                .Add(arrValues(1))

                .Add(arrValues(2))

                .Add(arrValues(3))
                .Add(arrValues(4))

                .Add(arrValues(5))
               

            End With

            'create buffer for holding data to return

            Dim buf As New System.Collections.Specialized.StringCollection
            'find y values where x equals something
            'For Each row As DataRow In myData.Select("x = '" & ":" & searchText & "'")
            For Each row As DataRow In myData.Select("x like ':111%'")
                buf.Add(row("x").ToString)
            Next

            'return results
            Return buf

        End Function

    can any one please correct my code to work sucessfully please
    Tuesday, December 4, 2007 5:54 PM