VB.Net select combo box item after it is filled from sql query

I have a web form with a bunch of text boxes and a few combo boxes.  I have a query that pulls back information to populate the textboxes and the combo boxes.  One of the items pulled back from the query is status... it is a string with either "Active" or "Closed"

The idea is that when a user opens the form (a project is selected) in the combo box should have the two options (active or closed), but the selected item should be the status pulled from the database

I really have know idea how to go about doing this

here is how I pull the data and how I fill the other controls - the combobox is that I want to fill is called cmbStatus

Thanks for the help experts

Private Sub FillPage(ByVal ProjId As String)
        Dim strConnString As String = ConfigurationManager.ConnectionStrings("TimberOpsConnectionString").ConnectionString
        Dim strQuery As String = "select KEYField, Status, GL_Code, Project_Code, Notification_Number, FKEYProjectType, name, brand, SubAccount, Plan_year, CrossOver_Year from tblProject  where KEYField = " & ProjId
        Dim con As New SqlConnection(strConnString)
        Dim cmd As New SqlCommand()
        'cmd.Parameters.AddWithValue("@KeyField", ProjId)
        cmd.CommandType = CommandType.Text
        cmd.CommandText = strQuery
        cmd.Connection = con
            Dim sdr As SqlDataReader = cmd.ExecuteReader()
            While sdr.Read()
                txtKey.Text = sdr(0).ToString()
                txtGLCode.Text = sdr(2).ToString()
                txtProjCode.Text = sdr(3).ToString()
                TxtNoteNumber.Text = sdr(4).ToString()
                txtProjName.Text = sdr(6).ToString()
                txtProjBrand.Text = sdr(7).ToString()
                txtSubAccount.Text = sdr(8).ToString()
                txtPlanYear.Text = sdr(9).ToString()
                txtCrossOverYear.Text = sdr(10).ToString()
            End While
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

Open in new window

David ModugnoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
assuming sdr(1).ToString() holds the value of "Status" then you can try:
if cmbStatus.Items.FindByValue(sdr(1).ToString()) is not nothing then
     cmbStatus.Items.FindByValue(sdr(1).ToString()).selected = true
end if

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David ModugnoAuthor Commented:
Not exactly what I needed but it got me where I needed to be
thanks for the help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.