Fill combobox, and pick up value menber Vb.net and mysql

Asked

Viewed 235 times

1

I need to fill a combobox with my mysql database, and then take the value menber to enter in the database

Att. I’m in need of help from a person who knows visual basic.net , I’m with a system, for a company that works in software, where I’m making a system out to my boss, the company withdraws monthly about 100 thousand, and from these gains we earn commission values for each sale, and outside the fixed salary, but the company has the size to earn more, but the system they market is half bad, full of problems, if anyone wants to help, contact 31 9 96508625 (Whatsapp)

1 answer

1

Good afternoon, you will fill the grid with the example below:

Dim sql = "SELECT IdAlimento, IdTipoAlimento, NomeTipoAlimento FROM muscle.tb_alimentos "

Dim dt As Object = DAL.AcessoBD.ExecutarComando(sql, CommandType.Text, 
Nothing, DAL.AcessoBD.TipoDeComando.ExecuteDataSet)

For intCount As Integer = dt.Tables(0).Rows.Count - 1 To 0 Step -1
     Me.grdAlimento.Rows.Add(dt.Tables(0).Rows(intCount)("IdAlimento"), dt.Tables(0).Rows(intCount)("IdTipoAlimento"), intCount2, dt.Tables(0).Rows(intCount)("NomeAlimento"))
     intCount2 = intCount2 + 1
Next

and to get the value of datagridview follows example below:

var intIdAlimento as Integer = grdAlimento.Rows(e.RowIndex).Cells(0).Value.ToString()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.