Dreams are renewable. No matter what our age or condition, there are still untapped possibilities within us and new beauty waiting to be born.

-Dale Turner-

Kamis, 04 April 2013

# Call ComboBox From Database and show Fill For Vb.net 2008




Sub StatusRoom()‘’==è Form Load (: Call StatusRoom())
        Cmd = New OleDbCommand("select * FROM StatusRoom", Conn)
        Dr = Cmd.ExecuteReader
        cmbStatus.Items.Clear()
        Do While Dr.Read
            cmbStatus.Items.Add(Dr.Item(0))
        Loop
    End Sub

Sub Status()’’==è combo IelectIndexChanged (: Call Status())
        cmbID.MaxLength = 4
        Cmd = New OleDbCommand("Select * from StatusRoom where Status='" & cmbStatus.Text & "'", Conn)
        Dr = Cmd.ExecuteReader
        Dr.Read()
        Refresh()
        If Dr.HasRows Then
            txtStatus.Text = Dr.Item("Status")
            Exit Sub
        End If
    End Sub

0 komentar:

Posting Komentar