Results 1 to 2 of 2

Thread: Question class

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2009
    Posts
    41

    Question class

    Hello all!

    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.

    Code:
            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
    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?

    Would this still be possible even though 25 separate forms will need to access it?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: Question class

    Moved to VB.NET. The FAQ forum isn't meant for asking questions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width