adding a blank row to a combobox

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

hi,
I have a combox in a datagrid linked to a dataset. I fill the dataset
using my own customised class and it works fine.

da.AddTable("select FieldTypeID, FieldType from FieldTypes",
DatabaseAccess.SQLType.Text)
m_dsFields = da.GetDataset

Dim r As New DataRow
m_dsFields.Tables(1).Rows.Add(r)

However the 2 lines above where I try to add a blank row to my dataset
don't work. How can I do that ?


Thx
 
changing the select might fix it

select FieldTypeID, FieldType from FieldTypes union all "", ""
 
JohnFol said:
changing the select might fix it

select FieldTypeID, FieldType from FieldTypes union all "", ""

That is really the simplest way to get this done.

Otherwise you'll have to create a new row using the DataTable object.
The row needs to be the same schema as the table so you have to create it
using the DataTable object.

Tom P.



Dim myNewRow as DataRow

myNewRow = myDataSet.Tables(0).NewRow

myNewRow(0)(0) = "<Empty>"

myDataSet.Tables(0).Rows.Add(myNewRow)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top