943,807 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 3753
  • VB.NET RSS
Oct 4th, 2005
0

retrieving "Data" from Listbox

Expand Post »
The following code is me loading a listbox with a table. I have no problem with the retrieving data if data has information, but if the field is empty I get a error. how can I check the field in a listbox first for DBnull?

'***1. load listbox from table

vStr = "Select social&' '&name as entry, title, street, RowNumber"
vStr += " from EmpAdds where "
vStr += " id_code = " + CType(cbEMPL.SelectedValue, String)

oCont = VB_LIB.MAIN.SQLSelect(vStr, oACC)

If oCont.Rows.Count > 0 Then
Me.lbOwnrInfo.DataSource = oCont
Me.lbOwnrInfo.DisplayMember = "entry"
Me.lbOwnrInfo.ValueMember = "RowNumber"
endif

'***2. Get Data from Listbox

temp = me.lbOwnrInfo.SelectedItem("street")

Thanks for any help!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robert Walker is offline Offline
12 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Problems with connections
Next Thread in VB.NET Forum Timeline: Web cam programming using VB.net on window 2000





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC