I was hoping someone could explain to me how to make this code more simple, clean and/or streamlined. It works perfectly as written, but it seems to me there must be a shorter or faster way to do this (i.e.: less lines of code)
Any advice is appreciated.
Thanks in advance.
PS: how do I make this code block show up in a smaller (scrolling) "box" so that my code laden posts dont take up so much real estate?
Any advice is appreciated.
Thanks in advance.
PS: how do I make this code block show up in a smaller (scrolling) "box" so that my code laden posts dont take up so much real estate?
Code:
Public Class Form1
Private Sub btnTax_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTax.Click
btnTaxRate.Visible = Not btnTaxRate.Visible
btnTaxExtra.Visible = Not btnTaxExtra.Visible
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnAssign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAssign.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Visible = Not btnAssignLabor.Visible
btnAssignArmy.Visible = Not btnAssignArmy.Visible
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnGive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGive.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Visible = Not btnGiveGold.Visible
btnGiveFood.Visible = Not btnGiveFood.Visible
btnGiveItems.Visible = Not btnGiveItems.Visible
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnTrain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTrain.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Visible = Not btnTrainTroops.Visible
btnTrainPrince.Visible = Not btnTrainPrince.Visible
btnTrainSelf.Visible = Not btnTrainSelf.Visible
btnTrainPeople.Visible = Not btnTrainPeople.Visible
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnTrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTrade.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Visible = Not btnTradeA.Visible
btnTradeB.Visible = Not btnTradeB.Visible
btnTradeC.Visible = Not btnTradeC.Visible
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnPeople_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPeople.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Visible = Not btnPeopleSwitch.Visible
btnPeopleSelect.Visible = Not btnPeopleSelect.Visible
btnPeopleDemote.Visible = Not btnPeopleDemote.Visible
btnPeoplePromote.Visible = Not btnPeoplePromote.Visible
btnPeopleMarry.Visible = Not btnPeopleMarry.Visible
btnPeopleDraft.Visible = Not btnPeopleDraft.Visible
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Visible = Not btnViewState.Visible
btnViewRuler.Visible = Not btnViewRuler.Visible
btnViewAlly.Visible = Not btnViewAlly.Visible
btnViewPrince.Visible = Not btnViewPrince.Visible
btnViewChild.Visible = Not btnViewChild.Visible
btnViewStock.Visible = Not btnViewStock.Visible
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnSpy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpy.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Visible = Not btnSpyView.Visible
btnSpyWreak.Visible = Not btnSpyWreak.Visible
btnSpyKill.Visible = Not btnSpyKill.Visible
btnSpySearch.Visible = Not btnSpySearch.Visible
End Sub
Private Sub btnMove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMove.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnPolicy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPolicy.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnTreaty_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTreaty.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
Private Sub btnWar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWar.Click
btnTaxRate.Hide()
btnTaxExtra.Hide()
btnAssignLabor.Hide()
btnAssignArmy.Hide()
btnGiveGold.Hide()
btnGiveFood.Hide()
btnGiveItems.Hide()
btnTrainTroops.Hide()
btnTrainPrince.Hide()
btnTrainSelf.Hide()
btnTrainPeople.Hide()
btnTradeA.Hide()
btnTradeB.Hide()
btnTradeC.Hide()
btnPeopleSwitch.Hide()
btnPeopleSelect.Hide()
btnPeopleDemote.Hide()
btnPeoplePromote.Hide()
btnPeopleMarry.Hide()
btnPeopleDraft.Hide()
btnViewState.Hide()
btnViewRuler.Hide()
btnViewAlly.Hide()
btnViewPrince.Hide()
btnViewChild.Hide()
btnViewStock.Hide()
btnSpyView.Hide()
btnSpyWreak.Hide()
btnSpyKill.Hide()
btnSpySearch.Hide()
End Sub
End Class