![]() ![]() The output of the project will be like the image below. The code will look like this: Private Sub Form_Load()ħ. In our case we will put the function in the load event of the form.ĭouble click the ComboBoxFrm form and type the Sub procedure (AddStudentName). ![]() To call a function or subroutine in Visual Basic, just type the name of that function or Sub procedure. The code above will only execute its function once it we will call it. The query above will get all the records under studentName and pass it over to our combo box (cmbDatabaseCombo).Ħ. Sql = " Select studentName from tblStudent Group by studentName order by studentName" Let’s create a function that will retrieve the records from our table and pass it to our combo box.Ĭopy the code below and paste in our ComboBoxFrm form: Public Sub AddStudentName() Rename the combo box into cmbDatabaseCombo.ĥ. In the image below, the highlighted one is our ComboBox control. In the Tool Box of our Visual Basic 6 program, kindly drag the combo box control to our newly created form (ComboBoxFrm). Let’s add a form to our project and name it as ComboBoxFrm.ģ. Open your visual basic 6 program and create a new project, select Standard EXE.Ģ. ![]() We will skip the procedures on how to connect visual basic 6 to ms access, but if you forgot that, kindly visit the tutorial on how to connect vb6 to ms access.ġ. Fill in only the studentName and studentCountry since ID is AutonNumber it will automatically assign a number to the record.Īfter we have created our database, let us proceed in our visual basic program. Insert records in our newly created table. The table should look like the image below:Ĥ. Save the table and insert the following field: Create a new table and name it as tblStudent.ģ. We must first create a MS Access database and name it as Data.mdb.Ģ. Two ways to add or populate item in our combo box:ġ. In this tutorial, we will going to learn two ways on how to add or populate item in the combo box. Source Code Top 90 Visual Basic Project IdeasĬombo Box in Visual Basic also refers as drop down lists or drop down boxes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |