Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

combo box databinding problem

Hi, everybody,

I have a winform combo box that binds to a dataset created by a sql stored proc. My question is how to make the combo box default to an empty/null value?

The combo is for users to select a Region as searching criteria. It has to be optional, meaning, it has to contain an empty entry with the regular West, East...

Do I make my stored proc returns an empty line at the top of normal data set, or add an empty entry into combo box after it was populated?

Neither seems is the right way to handle the situation.

Thanks!
0
ommer
Asked:
ommer
1 Solution
 
ZeonFlashCommented:
Either way is acceptable.  

SELECT NULL, NULL
UNION
SELECT Region, RegionValue
FROM ...

--Or--

'Fill dataset

Dim dr As DataRow = ds.Tables(0).NewRow

For Each col As DataColumn In ds.Tables(0).Columns
      dr.Item(col) = DBNull.Value
Next

ds.Tables(0).Rows.InsertAt(dr, 0)

'Bind dataset to combobox here
0
 
ommerAuthor Commented:
Cool!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now