0% found this document useful (0 votes)
30 views1 page

Nallely

This code is populating combo boxes from an Access database. When the form loads, it opens a connection to an Access database, runs a query to select all records from a table, and fills a data table. Button1 loops through the data table and adds the "Artista" field to the ComboBox1 items. Button2 does the same for the "Genero" field and ComboBox2. Button4 will display the selected genre.

Uploaded by

zuuiii
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views1 page

Nallely

This code is populating combo boxes from an Access database. When the form loads, it opens a connection to an Access database, runs a query to select all records from a table, and fills a data table. Button1 loops through the data table and adds the "Artista" field to the ComboBox1 items. Button2 does the same for the "Genero" field and ComboBox2. Button4 will display the selected genre.

Uploaded by

zuuiii
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Imports System.Data.OleDb Public Class Form1 Dim dt As New DataTable Dim Fila As Integer = 0 Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Alumnos\Documents\Combobox.

accdb") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For x = 0 To dt.Rows.Count - 1 ComboBox1.Items.Add(dt.Rows(x)("Artista")) Next End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cn.Open() Dim Consulta As String = "Select * from Combo" Dim dataAdapter As New OleDbDataAdapter(Consulta, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() cn.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For y = 0 To dt.Rows.Count - 1 ComboBox2.Items.Add(dt.Rows(y)("Genero")) Next End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click MsgBox("El genero es") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End Sub End Class

You might also like