Userform Userform Userform

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
I have some options (for example easy, hard, very hard) for the user to pick in the begining of my game. I put them in a listbox. It makes sense (to me at least) that once the game starts, these options should be "locked in". I know the game has started if any one of option buttons 1 thru 6 has been chosen. Is there a way to lock or grey or something to the listbox so that the user can't change it once the game has started?

Gene, "The Mortgage Man", Klein
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Use the .Enabled property.

Once the game has been started, set; ListBox.Enabled = False
Remeber to re-enable it when the game stops etc

eg:

Code:
If ComboBox1.Enabled = True Then
    ComboBox1.Enabled = False
Else
    ComboBox1.Enabled = True
End If

If ListBox1.Enabled = True Then
    ListBox1.Enabled = False
Else
    ListBox1.Enabled = True
End If
 
Upvote 0
OK I think I see - you are saying that instead of indirectly figuring out that the game has started by checking the six option buttons, just directly check
to see if the user has picked from the list box. Is that correct?

Gene, "The Mortgage Man", Klein
 
Upvote 0
code:

If ComboBox1.Enabled = True Then
ComboBox1.Enabled = False
Else
ComboBox1.Enabled = True
End If

If ListBox1.Enabled = True Then
ListBox1.Enabled = False
Else
ListBox1.Enabled = True
End If


Under the philosophy of no question being a stupid question (at least when I'm asking) where do I put the above code?

Gene, "The Mortgage Man", Klein
 
Upvote 0
Not sure how your game is set up, but if selecting an option from the ListBox constitutes the game being started then you could add the following to the ListBox_Change() sub along with all the other stuff that it should do when they select something from the ListBox.

Private Sub ListBox1_Change()

ListBox1.Enabled = False

You will also need to figure out when the game has stopped and insert the line;

ListBox1.Enabled = True

in order to allow them to select something else for the next game
 
Upvote 0

Forum statistics

Threads
1,224,884
Messages
6,181,571
Members
453,054
Latest member
arz007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top