I have a Listbox that shows a list of applications which is being populated by the SQLdataReader:
<asp:ListBox ID="ApplicationList" runat="server" Rows="4" DataTextField="str_application_name" DataValueField="str_application_id" ></asp:ListBox>
sqlcmd = "SELECT str_application_id, str_application_name FROM tbl_SRO_applications"
dbcomm = New SQLCommand(sqlcmd, oSQLConn)
'Create/Populate the DataReader
dbReader = dbcomm.ExecuteReader()
ApplicationList.DataSource = dbReader
The user selects the Application from the List and Clicks the Submit Button:
<asp:Button ID="button5" runat="server" OnClick="Submit"></asp:Button>
However I am recieving the error 'ListItem cannot be converted to type String':
Public Sub Submit(sender As Object, e As System.EventArgs)
Dim App as String
app = ApplicationList.SelectedItem
tester.Text="You selected " & ApplicationList.SelectedItem
Ideally I would like the App variable to store the "str_application_id" field...Assistance would be greatly appreciated.