Luis José Ruano Luis José Ruano - 3 months ago 46
Vb.net Question

fill specific column gridcontrol devexpress

I want to fill a specific column in a gridview. I want to do this with code, but I have already established the column in the gridcontrol as how you can see in the picture.

established Column

This is my code to fill the column, but I don't know what to do to fill that specific one column using name or fieldname or whatever it takes.

GridControl1.DataSource = Nothing

SQL.ExecQuErY("SELECT nombre FROM productos")

If Not String.IsNullOrEmpty(SQL.Exception) Then MsgBox(SQL.Exception) : Exit Sub

For Each row As DataRow In SQL.DBDS.Tables(0).Rows

?????? THIS IS WHERE IT'S SUPPOSED TO GO THE INSTRUCTION TO FILL THE COLUMN ??????

Next

Answer

Try to bind the data to your grid like this :

Sql.ExecQuErY("SELECT nombre As colNombre FROM productos")
GridControl1.DataSource = Sql.DBDS.Tables(0)

FieldName of column in GridControl must have same name of Field in DataSource.

or you can change FieldName of column in GridControl to nombre and use your initial query :

Sql.ExecQuErY("SELECT nombre FROM productos")
GridControl1.DataSource = Sql.DBDS.Tables(0)