|
-
Nov 19th, 2007, 01:54 AM
#1
Thread Starter
Junior Member
[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
-
Nov 19th, 2007, 02:28 AM
#2
Addicted Member
Re: Write selected combo button to file
declare and use a String variable like so:
vb Code:
Private Sub opt_team_Click(Index As Integer)
dim favTeam as String
Select Case Index
Case 0
favTeam = "Favorite Team: Boston Red Sox"
Case 1
favTeam = "Favorite Team: MSU Bulldogs"
Case 2
favTeam = "Favorite Team: New England Patriots"
Case 3
favTeam = "Favorite Team: Boston Bruins"
End Select
End Sub
-
Nov 19th, 2007, 02:42 AM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|