A
Alex A via .NET 247
Hello all. I'm new to .NET and I am stuck and I just cannot getthis to work (even after much searching).
I have a listbox populated by data from an Access Database. Themanner in which I fill the listbox is as follows:
\\\\\\\\
dsClosedPos.Clear()
dbAdapter.SelectCommand = New OleDbCommand
dbAdapter.SelectCommand.Connection = dbConnect
dbAdapter.SelectCommand.CommandText = _
"SELECT * FROM qryClosedOutPositions"
dbAdapter.SelectCommand.CommandType = CommandType.Text
dbConnect.Open()
dbAdapter.SelectCommand.ExecuteNonQuery()
dbAdapter.Fill(dsClosedPos, "ClosedPos")
dbConnect.Close()
lstClosedPos.DataSource =dsClosedPos.Tables("ClosedPos").DefaultView
lstClosedPos.DisplayMember = "TRADED"
\\\\\\
This populates the listbox (lostClosedPos) with the results fromthe query. I am tryint to retrieve the SelectedValue when auser makes a change. However, using something along the linesof lstClosedPos.SelectedItem.Tostring() orlstClosedPos.SelectedValue does not work. I need the value ofthe listbox selection as a variable for a query.
Any help would be appreciated.
I have a listbox populated by data from an Access Database. Themanner in which I fill the listbox is as follows:
\\\\\\\\
dsClosedPos.Clear()
dbAdapter.SelectCommand = New OleDbCommand
dbAdapter.SelectCommand.Connection = dbConnect
dbAdapter.SelectCommand.CommandText = _
"SELECT * FROM qryClosedOutPositions"
dbAdapter.SelectCommand.CommandType = CommandType.Text
dbConnect.Open()
dbAdapter.SelectCommand.ExecuteNonQuery()
dbAdapter.Fill(dsClosedPos, "ClosedPos")
dbConnect.Close()
lstClosedPos.DataSource =dsClosedPos.Tables("ClosedPos").DefaultView
lstClosedPos.DisplayMember = "TRADED"
\\\\\\
This populates the listbox (lostClosedPos) with the results fromthe query. I am tryint to retrieve the SelectedValue when auser makes a change. However, using something along the linesof lstClosedPos.SelectedItem.Tostring() orlstClosedPos.SelectedValue does not work. I need the value ofthe listbox selection as a variable for a query.
Any help would be appreciated.