G
Guest
Hello All,
The following code give me this error:
Index 3 is not non-negative and below total rows count.
Line 452: Private Sub cboSellers_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSellers.SelectedIndexChanged
Line 453: Dim ParentTableView As New
DataView(DsSellers1.Tables("SELLERS"))
Line 454: Dim CurrentRowView As DataRowView =
ParentTableView.Item(Me.cboSellers.SelectedValue)
Line 455:
Line 456: grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")
Stop at Line 454. I can't firgure out why is it erroring out. I have the
same code for two Datagrid (a master and detail) and it working sometimes. i
feel I'm missing a something. Can someone help on this. I like to get it fix
asap. Thanks in advances!
----------------------------------Code-----------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
If Not IsPostBack Then
'Fill all DataAdapters into DsSellers dataset.
Me.daSellers.Fill(Me.DsSellers1)
Me.daDoc_Type.Fill(Me.DsSellers1)
Me.daOccupancy.Fill(Me.DsSellers1)
Me.daProduct_Code.Fill(Me.DsSellers1)
Me.daProperty_Type.Fill(Me.DsSellers1)
Me.daPurpose.Fill(Me.DsSellers1)
'Data bind all data to their controls.
Me.cboSellers.DataBind()
Dim ParentColumn As New DataColumn
Dim ChildColumn As New DataColumn
ParentColumn =
DsSellers1.Tables("SELLERS").Columns("SELLER_ID")
ChildColumn =
DsSellers1.Tables("DOC_TYPE_LISTING").Columns("SELLER_ID")
Dim drSellers As New DataRelation("SellersRelation",
ParentColumn, ChildColumn)
DsSellers1.Relations.Add(drSellers)
End If
Catch ex As Exception
Response.Write(ex.Message)
Finally
Me.ConnWBOC5177.Close()
Me.ConnWBOC5177.Dispose()
End Try
End Sub
Private Sub cboSellers_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSellers.SelectedIndexChanged
Dim ParentTableView As New DataView(DsSellers1.Tables("SELLERS"))
Dim CurrentRowView As DataRowView =
ParentTableView.Item(Me.cboSellers.SelectedValue)
grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")
grdSellers.DataBind()
End Sub
The following code give me this error:
Index 3 is not non-negative and below total rows count.
Line 452: Private Sub cboSellers_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSellers.SelectedIndexChanged
Line 453: Dim ParentTableView As New
DataView(DsSellers1.Tables("SELLERS"))
Line 454: Dim CurrentRowView As DataRowView =
ParentTableView.Item(Me.cboSellers.SelectedValue)
Line 455:
Line 456: grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")
Stop at Line 454. I can't firgure out why is it erroring out. I have the
same code for two Datagrid (a master and detail) and it working sometimes. i
feel I'm missing a something. Can someone help on this. I like to get it fix
asap. Thanks in advances!
----------------------------------Code-----------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
If Not IsPostBack Then
'Fill all DataAdapters into DsSellers dataset.
Me.daSellers.Fill(Me.DsSellers1)
Me.daDoc_Type.Fill(Me.DsSellers1)
Me.daOccupancy.Fill(Me.DsSellers1)
Me.daProduct_Code.Fill(Me.DsSellers1)
Me.daProperty_Type.Fill(Me.DsSellers1)
Me.daPurpose.Fill(Me.DsSellers1)
'Data bind all data to their controls.
Me.cboSellers.DataBind()
Dim ParentColumn As New DataColumn
Dim ChildColumn As New DataColumn
ParentColumn =
DsSellers1.Tables("SELLERS").Columns("SELLER_ID")
ChildColumn =
DsSellers1.Tables("DOC_TYPE_LISTING").Columns("SELLER_ID")
Dim drSellers As New DataRelation("SellersRelation",
ParentColumn, ChildColumn)
DsSellers1.Relations.Add(drSellers)
End If
Catch ex As Exception
Response.Write(ex.Message)
Finally
Me.ConnWBOC5177.Close()
Me.ConnWBOC5177.Dispose()
End Try
End Sub
Private Sub cboSellers_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSellers.SelectedIndexChanged
Dim ParentTableView As New DataView(DsSellers1.Tables("SELLERS"))
Dim CurrentRowView As DataRowView =
ParentTableView.Item(Me.cboSellers.SelectedValue)
grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")
grdSellers.DataBind()
End Sub