Learning VB

Okay,

This may seem like a newbie question, and it probable is.  How does one go back to an originating form when the originating form could be one of many, many options.

 

So for example:

You have twelve forms.  Each named (for simplicity sakes) Form1 through Form12. 
Form1 can take you to each of the twelve forms.
Forms 2-5 can take you forms 6-12.
Forms 6-8 can take you forms 1, 2-5, 9-12 or they make go back to themselves (From Form 6 to Form 8 and vice versa)
Forms 9-12 can take you 1, 2-5, 6-8 or they make go back to themselves (From Form 9 to Form 12 and vice versa)

All Forms can always go back to Form 1 (which easy enough)

But if I am on Form 9 and I want to go back to 5 (an orginating Form)  is this possible, if so how is it done

I have Googled, Searched MSDN and looked through many books....but I am coming up with zip, not even a place to start from.

Also is there a way to keep track of which forms you have come from

Help....

 

Regards,

LVB



Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

well here's a dumb question. What on earth are all those forms for






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

Renee,

Hehehe....I am writing a prog that requires that specifics for each of the forms will be unique...so Classes wont work. How this really works is like this:
Form1 - Choose two options (second option is not available)
Form 2 - Choose from 29 different options that lead to 29 different forms, However once you have selected one of the 29 different forms you cannot select any of the other forms unless you comeback to Form 2, and in doing so you clear all the information from everything
Forms 3-32 Specific Forms that each have unique code
Form33 Accessible from Forms 3-32, as well as Forms 34,35, 36
Form 34 Accessible from Forms 3-32, as well as Forms 33,35, 36
Form 35 Accessible from Forms 3-32, as well as Forms 33,34, 36
Form 36 Accessible from Forms 3-32, as well as Forms 33,34, 35 (Final Form)

These options are to allow users to have control over the various things that they input, in order to change or alter a specific input.

Make sense

Regards,
LVB





Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

So I take it that this is not possible

LVB





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

I bet it can all be done in one form.

Multiple forms are very rarely needed unless there are dialogues etc.

The secret to this is intelligent up front design






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

ReneeC wrote:

The secret to this is intelligent up front design

Okay.....OUCH....

I am doing the best that I can with my experience here......I have re-written this thing three times..each time getting better than its previous incarnation.....

With that in mind I have decided to attempt to put everything together using just a couple of forums.

Currently, I am not understanding why something is not working.

In a Module called AcriesModule I have placed the following code:

Public Sub AciresRace()

If My.Forms.CharacterBase.cbxAgiRaceModifier.Checked AndAlso My.Forms.CharacterBase.cbxChaRaceModifier.Checked Then

' Check if the other checkbox is enabled and if it is then disable it

If My.Forms.CharacterBase.cbxStrRaceModifier.Enabled = True Then My.Forms.CharacterBase.cbxStrRaceModifier.Enabled = False

ElseIf My.Forms.CharacterBase.cbxAgiRaceModifier.Checked AndAlso My.Forms.CharacterBase.cbxStrRaceModifier.Checked Then

' Check if the other checkbox is enabled and if it is then disable it

If My.Forms.CharacterBase.cbxChaRaceModifier.Enabled = True Then My.Forms.CharacterBase.cbxChaRaceModifier.Enabled = False

ElseIf My.Forms.CharacterBase.cbxChaRaceModifier.Checked AndAlso My.Forms.CharacterBase.cbxStrRaceModifier.Checked Then

' Check if the other checkbox is enabled and if it is then disable it

If My.Forms.CharacterBase.cbxAgiRaceModifier.Enabled = True Then My.Forms.CharacterBase.cbxAgiRaceModifier.Enabled = False

Else

' Enable all of the checkboxes

If My.Forms.CharacterBase.cbxAgiRaceModifier.Enabled = False Then My.Forms.CharacterBase.cbxAgiRaceModifier.Enabled = True

If My.Forms.CharacterBase.cbxStrRaceModifier.Enabled = False Then My.Forms.CharacterBase.cbxStrRaceModifier.Enabled = True

If My.Forms.CharacterBase.cbxChaRaceModifier.Enabled = False Then My.Forms.CharacterBase.cbxChaRaceModifier.Enabled = True

End If

If My.Forms.CharacterBase.cbxStrRaceModifier.Checked = True Then

AciresStr = 10

End If

If My.Forms.CharacterBase.cbxAgiRaceModifier.Checked = True Then

AciresAgi = 10

End If

If My.Forms.CharacterBase.cbxChaRaceModifier.Checked = True Then

AciresCha = 10

End If

RaceStrMod = AciresStr

RaceAgiMod = AciresAgi

RaceChaMod = AciresCha

End Sub

Then in the Form Called CharacterBase I am doing the following

Private Sub Character_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, _

cboPhilosophy.SelectedIndexChanged, cbxAgiRaceModifier.CheckedChanged, cbxChaRaceModifier.CheckedChanged, cbxStrRaceModifier.CheckedChanged

'Acries Character

If My.Forms.frmRaceSelect.cbxAcires.Checked = True Then

Call AciresRace()

'Add SubRaces

Me.cboSubRace.Items.Add("None")

'Turn On Racial Modifier Boxes and Labels

Me.cbxStrRaceModifier.Visible = True

Me.cbxAgiRaceModifier.Visible = True

Me.cbxChaRaceModifier.Visible = True

Me.lblStrRaceModifier.Visible = True

Me.lblAgiRaceModifier.Visible = True

Me.lblChaRaceModifier.Visible = True

lblStrRaceModifier.Text = CStr(RaceStrMod)

lblAgiRaceModifier.Text = CStr(RaceAgiMod)

lblChaRaceModifier.Text = CStr(RaceChaMod)

End If

Call MentalAttributes()

Me.lblStrBase.Text = CStr(StrBase)

Me.lblStaBase.Text = CStr(StaBase)

Me.lblAgiBase.Text = CStr(AgiBase)

Me.lblPerBase.Text = CStr(PerBase)

Me.lblIntBase.Text = CStr(IntBase)

Me.lblWitsBase.Text = CStr(WitsBase)

Me.lblWillBase.Text = CStr(WillBase)

Me.lblChaBase.Text = CStr(ChaBase)

'Get Philosophy

Philosophy = Me.cboPhilosophy.SelectedItem

Call BaseRacialCharacter()

Call SilverDetermination()

End Sub

For the most part this works. However, the when i run the prog and click on the CheckBoxes under: cbxAgiRaceModifier.CheckedChanged, cbxChaRaceModifier.CheckedChanged, cbxStrRaceModifier.CheckedChanged

And are "manipulated" in the Acries Module, they do not work. Meaning that 1) the CheckBoxes do not diable and 2) they do not populate the appropriate Labels with the information.

I have highlighted all the pertinant information in Yellow.

Ideas





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

Everything pertinent

lblStrRaceModifier.Text = CStr(RaceStrMod)

WHat is the value of this variable/






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

I havent cleaned up the code yet....but

RaceStrMod = AciresStr

AciresStr = 10





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

lblStrRaceModifier.Text = CStr(RaceStrMod)

out of curiosity..... place an exit sub right after this line and see what happens






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

Okay,
Well i did as you asked and it placed a '0' in the appropriate box but when I clicked on the corresponding CheckBox the other two ChkBxs remained on. In addition, the Bases (StrBase, StaBase, AgiBase, etc.) did not fill in at load (b/c we exited the sub)





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

it wasn't supposed to work.... you did that to get a piece of information.

Am I correct in assuming that as you see it the label remains blank If it says 0 there and blnk when finished. It's being reset or cleared someplace,






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

These are the times that I could share my code with you so you could see what I am trying to do....and possibly share some insights and suggestions....





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

break the problems down into something manageable so you can focus.

Identify the hotest potato....

But this is tricky because the entire design may be the hottest potato. Don't fix a dying horse that just had a stroke and congenital heart failure.

If the design is OK - fix the hottest potato, then the next hottest potato.






Re: Visual Basic Express Edition Going back to Originating Form

Learning VB

Let me ask you a question then.

If in my AciresModule I have the following:

If My.Forms.Character.cbxAgiRaceModifier.Checked AndAlso My.Forms.Character.cbxChaRaceModifier.Checked Then

' Check if the other checkbox is enabled and if it is then disable it

If My.Forms.Character.cbxStrRaceModifier.Enabled = True Then My.Forms.Character.cbxStrRaceModifier.Enabled = False

 

Does this not mean that when I call it like this:

Private Sub CharacterAttributes(ByVal sender As Object, ByVal e As EventArgs) Handles _

cbxAgiRaceModifier.CheckedChanged, cbxChaRaceModifier.CheckedChanged, cbxStrRaceModifier.CheckedChanged

If My.Forms.frmRaceSelect.cbxAcires.Checked Then

Call AciresRace()

End If

End Sub

That the code in the module will act as though it were "local", I mean i can put the same code in a Private Sub TestOnly () and call it in the PrivateSub CharacterAttributes and it works.....But does not work if I have:

If My.Forms.frmRaceSelect.cbxAcires.Checked Then

What the hell am I missing

------pounds head on desk------

 





Re: Visual Basic Express Edition Going back to Originating Form

ReneeC

Question:

Do you single step with the debugger

Also are any exceptions showing up in the immediate window