Results 1 to 3 of 3

Thread: [RESOLVED] Write selected combo button to file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Posts
    31

    Resolved [RESOLVED] Write selected combo button to file

    I'm having problems with an index of radio buttons that i have within a frame.
    I have 4 option buttons in an index opt_team(0)-(3) which have Captions of 4 different sports teams.
    The current way I'm doing it is workable but I dont think its proper.
    I'm currently doing a Select Case when the opt_team_Click event occurs and then sending the results of the select case to a hidden textbox, which i then write the text to the file using write.

    Here is my current code, can someone tell me how to do this basic procedure without the textbox?

    Code:
    Private Sub opt_team_Click(Index As Integer)
    
            Select Case Index
                Case 0
                    txt_Team.Text = "Favorite Team: Boston Red Sox"
                Case 1
                    txt_Team.Text = "Favorite Team: MSU Bulldogs"
                Case 2
                    txt_Team.Text = "Favorite Team: New England Patriots"
                Case 3
                    txt_Team.Text = "Favorite Team: Boston Bruins"
                End Select
    End Sub

  2. #2
    Addicted Member TBeck's Avatar
    Join Date
    Apr 2006
    Location
    Ontario, Canada
    Posts
    254

    Re: Write selected combo button to file

    declare and use a String variable like so:

    vb Code:
    1. Private Sub opt_team_Click(Index As Integer)
    2.  
    3. dim favTeam as String
    4.  
    5.         Select Case Index
    6.             Case 0
    7.                 favTeam = "Favorite Team: Boston Red Sox"
    8.             Case 1
    9.                 favTeam = "Favorite Team: MSU Bulldogs"
    10.             Case 2
    11.                 favTeam = "Favorite Team: New England Patriots"
    12.             Case 3
    13.                 favTeam = "Favorite Team: Boston Bruins"
    14.             End Select
    15. End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Posts
    31

    Re: Write selected combo button to file

    Thanks TBeck, that did it. I thought I had already tried that and receieved an error for using the same variable in different cases which confused me.

    Moved the variable to the top in Gen Dec and everything looks to be fine.
    Thanks for the quick solution.

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