Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15571

Get nth item in a combobox

$
0
0
Help! I just want to pan through my values in a combobox at the same time I'm adding them. If the last number = the current number, skip.

Query uses this logic:
Code:

        sql = "SELECT LEFT(JobNo, 6) From [JobSheet].[dbo].[JobInfo] ORDER BY JobNo "
If I could calculate a way to get distinct data of the left six characters, it would have been a lot easier. SELECT DISTINCT LEFT(JobNo, 6) produced nothing.


Code:

        Dim cbocount As Integer = 1
        Do While Not rs.EOF
            Try
                MessageBox.Show(cbocount)
                MessageBox.Show(cboJob.Items(cbocount))
                If cboJob.Items(cbocount) <> rs(0).Value Then
                    cboJob.Items.Add(rs(0).Value)

                End If

            Catch

            End Try

            cbocount = cbocount + 1
            rs.MoveNext()

        Loop

Thanks!

Viewing all articles
Browse latest Browse all 15571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>