.

.

Monday, May 5, 2014

Tampilkan List ComboBox Dari Records Database

12:11 PM

Tampilkan List ComboBox Dari Records Database

Harap perhatikan koneksi pada database di tiap PC anda.
langsung copas biar seperti di bawah ini .

Langsung copas :

Public Sub caricombo()
        Dim conn As New SqlConnection
        Dim cmd As SqlCommand
        Dim rdr As SqlDataReader

        conn = New SqlConnection(dinas_penduduukan_pencatatan_sipil.My.Settings.db1ConnectionString)

        Try
            conn.Open()
            cmd = New SqlCommand("SELECT id_penduduk FROM penduduk", conn)
            rdr = cmd.ExecuteReader()

            While rdr.Read()
                TextBox7.Items.Add(rdr("id_penduduk"))
            End While

        Catch ex As Exception
            MessageBox.Show("Koneksi Gagal !!!, karena " & ex.Message)
        End Try

        'ComboBox1.SelectedIndex = 0
    End Sub

Lalu panggil fungsi caricombo di form load.

Sekian dan terima kasih

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 CYBER_HUNTER. All rights resevered. Designed by Templateism

Back To Top