I've done a search and didn't get anything so I guess I'll start a post.
I use vb so hopefully I can get a vb answer.
I have two controls that bind data in two tables to two listboxes.
What I an trying to do is select an Item in box 1 click a select button and move it to box 2. I have this code behind my select button but I get and Object reference not set to an instance of an object error so I try to use Dim DR as New Datarow but new is not a member of that class. So How can I move the selected data row to my new table?
Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
Dim I As Integer = ListUICView.SelectedIndex
Dim DR As DataRow
'DR.BeginEdit()
DR.Item("UPC") = UICList.Rows(I).Item("UPC")
DR.Item("UNITList") = UICList.Rows(I).Item("UNITList")
'DR.EndEdit()
UICSelected.ImportRow(DR)
UICSelected.AcceptChanges()
UICList.Rows(I).Delete()
BindListboxes()
End Sub
This is my stack trace but I haven't figured out how to read this yet.
[NullReferenceException: Object reference not set to an instance of an object.]
MILPO_App.UMRWait_UIC.btnSelect_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()