Hey everyone, I'm sort of new here, I've been reading the boards for a while but this is the first time I post.
I'm taking a VB class and I want to do an extra credit assignment that consists of creating a web application.
The problem I'm having is that the table only shows the image at the last cell. It populates the tool tips fine, but only shows the cell and image for the last one. The program is supposed to get the image and tooltip from the database, there's an extra field in the database called "SignID" which is numbers 1-15 (There's 15 images in total, the table is 5 columns by 3 rows) but I don't think I need to use it since I'm using intIndex to place the images in the cells.
Anyway, here's my code, thanks in advance for any help/advice:
I'm taking a VB class and I want to do an extra credit assignment that consists of creating a web application.
The problem I'm having is that the table only shows the image at the last cell. It populates the tool tips fine, but only shows the cell and image for the last one. The program is supposed to get the image and tooltip from the database, there's an extra field in the database called "SignID" which is numbers 1-15 (There's 15 images in total, the table is 5 columns by 3 rows) but I don't think I need to use it since I'm using intIndex to place the images in the cells.
Anyway, here's my code, thanks in advance for any help/advice:
Code:
Dim imgSign As Image = New Image
Dim intCount As Integer = 0
Dim intIndex As Integer = 0
Me.objOleDbConnection.Open()
Dim objReader As OleDbDataReader
objReader = Me.objOleDbSelectSignInformation.ExecuteReader()
Do While intCount < 5
objReader.Read()
imgSign.ImageUrl = "SignImages/" & objReader("sign").ToString
tblRoadSigns.Rows(0).Cells(intIndex).Controls.Add(imgSign)
tblRoadSigns.Rows(0).Cells(intIndex).ToolTip = objReader("name").ToString
intCount += 1
intIndex += 1
Loop
intIndex = 0
Do While intCount >= 5 And intCount < 10
objReader.Read()
imgSign.ImageUrl = "SignImages/" & objReader("sign").ToString
tblRoadSigns.Rows(1).Cells(intIndex).Controls.Add(imgSign)
tblRoadSigns.Rows(1).Cells(intIndex).ToolTip = objReader("name").ToString
intCount += 1
intIndex += 1
Loop
intIndex = 0
Do While intCount >= 10 And intCount < 15
objReader.Read()
imgSign.ImageUrl = "SignImages/" & objReader("sign").ToString
tblRoadSigns.Rows(2).Cells(intIndex).Controls.Add(imgSign)
tblRoadSigns.Rows(2).Cells(intIndex).ToolTip = objReader("name").ToString
intCount += 1
intIndex += 1
Loop
objReader.Close()
Me.objOleDbConnection.Close()