Solved

combo box databinding problem

Posted on 2006-07-20
2
216 Views
Last Modified: 2010-04-23
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
Comment
Question by:ommer
2 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 125 total points
ID: 17149883
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
 

Author Comment

by:ommer
ID: 17153837
Cool!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now