Fill in combobox, and get value menber vb.net and mysql

1

I need to populate a combobox with my mysql database, and then get the value menber to insert into the database

Att. I am needing help from a person who knows about visual basic.net, I am with a system, for a company that works in software, where I am making a system out for my boss, the company withdraws about 100 thousand monthly, and of these gain we earn commission amounts for each sale, and outside the fixed salary, however the company has the postage to earn more, however the system that they commercialize is a bit bad, full of problems, if someone wants to help, contact 31 9 96508625 whatsapp

    
asked by anonymous 01.04.2018 / 21:50

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 the datagridview follows example below:

var intIdAlimento as Integer = grdAlimento.Rows(e.RowIndex).Cells(0).Value.ToString()
    
12.04.2018 / 18:56