|
-
Apr 2nd, 2004, 07:16 AM
#2
Lively Member
I wonder: using your code does your combobox get filled anyway ?
this is how new() for dataset is described in msdn:
Public Sub New(String)
This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
i doubt your dataset is created correctley
you should first add new dataset to your project by right-clicking on your project in solution explorer>add new item
then design the dataset to look like your table, add an instance of the dataset to your form from the toolbox (you will find dataset on the "Data" tab),specify the dataset you created when asked,
and just then
instead of adding each row to the combobox use this code:
VB Code:
cmbSurname.datasource = mydataset.Employees 'Employees is the table name you specify in dataset in design mode
cmbSurname.ValueMember = cmbsurname.Employees.employeeID
cmbSurname.DisplayMember = cmbsurname.Employees.Surname
'note you can choose the datasource, valuemember, and displaymember in design mode for the combobox
dataset creation is far more complicated through code as far as i read in msdn.
you must specify valuetype , and other properies for each column of a datatable , add the columns to the datatable, then add the datatable to the dataset.
if i am wrong and your combobox gets filled with your values well , then i'm wrong. i just read about creating datasets in msdn and decided to create datasets through designer. i never tried creating them by code.
Last edited by mindloop; Apr 2nd, 2004 at 08:13 AM.
ehmm...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|