| | |
retrieving "Data" from Listbox
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2005
Posts: 12
Reputation:
Solved Threads: 0
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!
'***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
- Get data from Access instead of Notepad (URGENT) (C#)
- Transferring data to Excel (ASP.NET)
- Controlling GridView with a ListBox(multible selections enabled) (ASP.NET)
- Binary resource data (C)
- Populate Listboxes with table data (VB.NET)
- HELP:Data Files (C)
- Login and retrieve user data from database (ASP.NET)
- HELP!! "the document contains no data"?? (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: Problems with connections
- Next Thread: Web cam programming using VB.net on window 2000
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





