Apr 4th, 2009, 01:45 AM
I'm just learning about classes and was going to use one in my jeopardy game. I have the basic class working but I basically have 25 question forms with one question and four answers each which are all data bound controls. Right now, I'm storing everything from my database in an instance of the class that I created in each form's code and then I'm assigning them each to the labels on the particular question form in the game.
My question is this, since all of the questions in the game are in one column all the time and all answerA's, B's, ect. are in one column at one time, is there a way to use a for next loop to quickly populate one main class instance that contains of all of the questions and answers for the entire database?
Dim question100 As New frmQuestion
Dim currentRow As DataRow
Dim currentTable As DataTable
currentTable = Me.JeopardyDataSet.Tables("gameResource")
currentRow = currentTable.Rows(pos)
question100.Question = currentRow.Item(1)
QuestionLabel1.Text = question100.Question
question100.AnswerA = currentRow.Item(2)
Answer_ALabel1.Text = question100.AnswerA
question100.AnswerB = currentRow.Item(3)
Answer_BLabel1.Text = question100.AnswerB
question100.AnswerC = currentRow.Item(4)
Answer_CLabel1.Text = question100.AnswerC
question100.AnswerD = currentRow.Item(5)
Answer_DLabel1.Text = question100.AnswerD
Would this still be possible even though 25 separate forms will need to access it?
Click Here to Expand Forum to Full Width
Survey posted by VBForums.