Hi,

Create table myTable(
title ENUM ('Mr', 'Mrs', 'Miss') NOT NULL DEFAULT 'Mr'
);

How can i load ('Mr', 'Mrs', 'Miss') into a combobox in VB6.

Thanks

Recommended Answers

All 6 Replies

Hi,
Draw a Combobox(ComboBox1)

ComboBox1.AddItem "Mr"
  ComboBox1.AddItem "Mrs"
  ComboBox1.AddItem "Miss"

I know your solution but, I have to bring ENUM ('Mr', 'Mrs', 'Miss') from table.

Hi,

You mean, you want both Enum and ComboBox to be filled with data from the database table...?

Regards
Veena

Hi,

I have a comboBox in my Form1. When Form1.Load then, comboBox must have those ENUM values from that Table. Because, some people always add new values. They don't tell me to add it in my VB6 code.

Thanks

Hi,

If you are using VB6, open the recordset to the table, loop thru and populate the combo box, Check this :

Dim RST As New ADODB.RecordSet
Combo1.Clear
RST.Open "Select Distinct Title From MyTable",Conn
If Not RST.EOF  Then
    RST.MoveFirst
   Do While Not RST.EOF
       Combo1.AddItem RST(0) & ""
       RST.MoveNext
   Loop
End If

Regards
Veena

Hi,

I doesn't list all the values. Jumps on some values. Example; 1,2,3,4,5 this is listed as 1,3,5 or doesn't list one or two of them

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.