Dim objItems As clsItems
'Loads the pages with the Gridview and Infomation pretaining to the Item selected
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim qryItemNum As String = Request.QueryString("qryItemNum")
'Populates Gridview
If Not Page.IsPostBack Then
gvwCategorySelect.DataSource = clsCategory.GetList
gvwCategorySelect.DataBind()
'imgbtnPrev.Visible = False
'If Not String.IsNullOrEmpty(qryItemNum) Then
' Dim ItemNum As Int32
' If Int32.TryParse(test, ItemNum) Then
' imgbtnPrev.Visible = (-1 < ItemNum)
' End If
'End If
End If
objItems = New clsItems(qryItemNum)
'Set up the from labels
lblTitle.Text = objItems.Title
lblPrice.Text = objItems.Price.ToString("C")
lblDescription.Text = objItems.Description
ImgItem.ImageUrl = "~/images/ItemImages/Item" & objItems.ItemNum & ".jpg"
End Sub
'Returns to pervious item
Protected Sub imgbtnPrev_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles imgbtnPrev.Click
Response.Redirect("~/ItemInfo.aspx?qryItemNum=" & objItems.ItemNum - 1)
End Sub
'Next item
Protected Sub imgbtnNext_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles imgbtnNext.Click
Response.Redirect("~/ItemInfo.aspx?qryItemNum=" & objItems.ItemNum + 1)
End Sub
In the code above there are 2 image buttons, that move between different ItemNum. Im trying to stop the user from clicking the previous button, by removing the imgbtnPrev button when the query string at 1.
The error message says There is no row at position 0
dataRowObject = DBMethods.CreateTable(sqlString, sqlArg).Rows(0)
^ here is where is its highlighted.
Try this
Edit: I converted that to VB.NET