loading data into a combobox

Hi everybody

How i can load from a database field into my combobox all the information as a list of items?

The datacontrol has a bug (i belive) so i need it via code

Many thanks

There’s a bug?

Let’s debug:
What code have you tried?
Where does it break?
What was the expected result?

Have you looked at the ComboBox Documentation? It looks pretty simple to loop through all values and add them.

Hi Tim

Yes the datacontrol has a bug in it behavior, because after setting the database name and table name, in debug mode the databse name and table name is resetting to “None”.

So due this reason i need to create a databasefile via code and because this datacontrol is not working and i cannot read the information as list into my combobox.

So my question is: it is possible do it via code?

Sorry for my english

Alan

Hi Tim

Anyway as follow the code :

Dim sql As String
sql = “SELECT * FROM Cliente”

Dim rs As RecordSet
rs = Principale.MasterDatabase.SQLSelect(sql)

If MasterDatabase.Error Then
DisplayDatabaseError false
Return
End If

If rs <> Nil Then
While Not rs.EOF
me.AddRow rs.Field(“via”).StringValue

  rs.MoveNext
Wend
rs.Close

End If

In the open event of the combobox im getteing an error (in negrita) instead in the gotfocus event is working fine

Alan

If you are opening your database in the window open event, then it won’t be available in the control open event. Try moving your code to the window open event, or open your database in the application.open event.

Hi Wayne

I put it in the app open event and works beautiful.

Many thanks