Results 1 to 7 of 7

Thread: VB Variables

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Location
    UK
    Posts
    4

    VB Variables

    Hi, how do I assign my radio buttons and labels as a variable?

    I am doing a quiz project and i want my labels to be different each time with different answers to choose from. All of my questions and answers are on Access. I need to display them on my radio buttons and labels. Any idea how i can do that?
    Any advice will be appreciated.

    thank you

  2. #2
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: VB Variables

    I didnt get your question completely.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Location
    UK
    Posts
    4

    Re: VB Variables

    Quote Originally Posted by Abid Durrani View Post
    I didnt get your question completely.
    I just want to know how I can assign radio buttons and labels as a variable.

  4. #4
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: VB Variables

    Answer to your question:
    Code:
    Dim radio As RadioButton
    radio = RadioButton1
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

  5. #5
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: VB Variables

    @marman, would that not be

    vb Code:
    1. Dim radio as New RadioButton
    2. radio=RadioButton1

    if i get your question correctly then i would place all the questions, answers in a list(of QA) {where QA would be defined by a structure containing Question, AnswerA,AnswerB etc and anything else (like score)} then i would create a random number function which would populate the list(of QA) with randomly selected questions from your database (ensuring in this function that you have not duplicated the question in the list already. It is then a case of using a For each loop to populate the form contents.
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  6. #6
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: VB Variables

    @Megalith: Depends. Do you want an existing radiobutton or a new one. If you want a new one then your first statement is correct since it creates a new button. But then you destroy the new button with your second statement which replaces the new button with an existing one.

    We don't know since it wasn't explained clearly. But choices are good!
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

  7. #7
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: VB Variables

    Agreed, ultimately the OP needs to supply more info and hopefully an example of code written to date or specific problems encountered
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

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