Hi,
I'm trying to insert 2 fields of same ROW in a ListBox.
Following is the code in VB I had done previously: It worked
pretty straight forward.
------------------------In VB-------------------
If (DataContact.EOF = True) Then Combo2.Text = "No Item"
Do While Not DataContact.EOF
Combo2.AddItem DataContact.Fields("Contact_Name_VC")
Combo2.AddItem
DataContact.Fields("Sub_Contact_Name_VC")
Combo2.ItemData(Combo2.NewIndex) =
DataContact.Fields("Contact_ID")
DataContact.MoveNext
Loop
'End If
'close the recordsrt
DataContact.Close
Set DataContact = Nothing
========================In VB.NET=========
Try
ContactMgrConnection.Open()
' Response.Write(strFeeMgrQuery)
ContactMgrDatareader =
ContactMgrCommand.ExecuteReader(CommandBehavior.Cl oseConnection)
ListBox1.DataSource = ContactMgrDatareader
ListBox1.DataValueField = "Contact_ID"
ListBox1.DataTextField = "Contact_Name_VC"
ListBox1.DataTextField = "Sub_Contact_Name_VC"
ListBox1.DataBind()
Catch myException As Exception
'I'm able to trap only Sub_contact_Elements not Contact_elements
========================================
But I'm unable to execute the same in vb.net.
Any feed backe will be a real help.
Thanks.