vb.net ListBox Help

  • From: "Richard Thomas" <rthomas@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 30 Nov 2007 08:09:29 -0500

Hi Guys:
I bind a ListBox to a DataTable in a Load Event and load it.  This works fine. 
I can arrow up and down and the entries are correct. 
I can not read the entries in the ListBox into a TextBox.
Even though I arrow up and down the list and the IndexChanged event fires the 
TextBox always shows the first entry in the list.
Public Class frmStocksReport
dim Dt As StockFDataSet.StocksDataTable
Private Sub lbStocksReportNdx_SelectedIndexChanged( ByVal sender As 
System.Object,  ByVal e As System.EventArgs) _
Handles lbStocksReportNdx.SelectedIndexChanged
MessageBox.Show( "item is " & lbStocksReportNdx.SelectedItem).ToString()
Note: the above always shows the index as 0.' tbDescription.Text = _
MessageBox.Show(  _
DirectCast( _
lbStocksReportNdx.SelectedItem, DataRowView)("Ticker").ToString())
Note: The above always shows the first item's Ticker Symbol.
End Sub
Do I somehow need to synch the underlying DataView or DataTable to the ListBox 
Selected Item somehow?
Should I scrap the whole DataBinding senario?
Any Ideas?
Rick Farmington Mich. USA

Other related posts: