i'm not sure if this is where i ask this Question so, if i am wrong please tell me ok. any way, i have an app that is connected to a DB. and it works all fine and dandy, the only problem is, the people that i am writing it for want a back button that will take you back to the last form that was loaded. i'm not so sure of how to do this because it can always be different.
ex.
FormA loads, they click a button and FormB loads, then they load FormC, but now want to go back to FormB.
is that possible to do? to go strait back to the form that was previously loaded with all the exact same data?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
I like to load form over forms so if someone hit my back button or the little X, it just unload the form their on and goes to the form before!
You in Up state NY?
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
so this code is just setting every thing there back into a null value correct? and it shows a different form. but you already know the name of the form.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
Yes I do, but this form was hide (frmFaet330SelRec.hide) so when you go back you must do a .show! But if you do not hide it you will not have to show it!
Massena, the annual St. Lawrence Bowfishing Championship
I try to come up for this every year!
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
I have used another method for a data entry program. The problem was that the sequence of forms could be really long, with each form calling another form, etc, until the stack overflowed and the program crashed. (there are ways around this, but I didn't use them at the time). The solution I came up with was this:
The program consists of a main loop:
stop = False
Do While Not stop
Ladder()
Loop
In this code, stop is a boolean. This loop will execute until stop is set to true. The function Ladder() was a large case statement. Each case showed a form modally. The selection for the case statement was a global state variable. Each form was responsible for setting itself up, and cleaning up when it was done, as well as setting the state variable to the correct value for the next form to be shown.
As for setting up a form or clearing a form, all the data shown on the form was stored into variables when the user left a form. If there was data in the variables when they came back to it, it was put back into the form. With this method, the user could return to each form as many times as they wanted, but when all was ready (sort of like the way a wizard works), a function was called that saved the data and cleared all the variables.
ok so lets say
FormA loads then the user goes to FormC how would you know to send the user to formA when he clicks back? my problem is that theusers won't always go in a linear approach. they may start@ formB then move formA then go to FormC. i need to allow them to go back to the screen that they were just at.
You don't use poles when you fish? i have bow fished a little and i liked it. never found the equipment to do it for real. i used just a bow and and arrow. don't you need one of those reels for it?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
Yes, you want a reel. We had a guy here who shot an arrow that reached the end of it's tether. At that point, it rebounded almost directly, and went through his eye, killing him. That's a bad day.
I see your problem. My situation was that for each button, there was only one reasonable form. There was a Next and Back, but they were in a sequence, so the Next and Back were always the same for any one form.
One way to solve that would be to have a LastState variable which you loaded as you left any form. The next form would always be able to check that variable to tell which form was the last form. Of course, you could also have a stack of last state variables to allow the user to back up all the way through the sequence.
the dude just tied a string to the end of the arrow? if so why would you even think of doing that? i know that you want to keep the fish on a line but my goodness please think before you act.
so what is a LastState variable? is it some thing that i need to create as far as Diming it?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
We have our share of rednecks I also have several colleagues who go carpooning in the spring. I don't see the point myself. I realize that carp are an invasive exotic species out here, but you can't eat them (or at least I wouldn't eat them or anything else out of those waters).
What I meant by the LastState variable was just a Long type that could hold the number for the last form that was shown. Each form has a number, which is used in the select case I mentioned a couple of posts back. By storing who was shown last, the current form can always go back to the last form by setting the state variable such that the next form to be shown is the last form that was shown.
I could EASILY have made that last sentence even more convoluted than it already is, but I saw no point in it. However, it still may not be clear enough to make any sense.
we have lots of rednecks here too. what is carpooning? bow fishing for carp? i eat things out of the river behind my house, like rocks and plants. j/k. depending on what i catch i'll eat, i once caught a really nice bass out of there and i ate it, it was really good. i guess you can eat carp clean them right but i don't know what i am doing as far as cleaning fish goes(most of the time) but i am learning.
i understand your last sentence. i unserstand what is going on, i just now need to understand the first post u made about the select case and loading the forms, i have a really large app and it has over 13 forms in it. but only 3 major ones. so i gues i could make the select statement work off of those.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
Any fish can be eaten if it is cooked well. If it tastes like crap, just blacken it, then you could eat a sponge and it would taste good.
Carpooning: Bow fishing for carp. A good redneck sport.
The program I had that in used over a dozen forms, so size isn't an issue. The ladder() function just looked something like this:
VB Code:
Private Sub Ladder()
Select Case stateVar
case 1
Form1.show 1
case 2
Form2.show 2
End Select
End Sub
There were many more cases, including one that set the stop variable to true so that the initial loop would quit. It worked pretty slick.
My concern was that if you have code like:
Me.hide
Form2.show 1
in a button click routine, then each button routine would cause another form to show modally without ever finishing. Thus the call stack would show Form1 calling form2 calling form3 calling form1 (again) etc. Each of these calls takes up a certain amount of space on the stack. Eventually (after a long time), the stack would overflow, and the program would crash. This is not a problem if you show the forms non-modally, but that depends on how you design the program.
i have used the frm.show and the unload me for most things but there are a number of forms that cannot be loaded unless a certain form is loaded. so the select case i could use just 3 cases. i counted and i have 17 forms. and i think that i may have to add more. if i do the select statement then, for the back buttons, i would just have what ever the last form that was loaded, load again correct?
you're primarily an ocean fisher then? we mostly have good musky and pike fishing around here unless you go to kinzua dam and then you can catch many different types of fish. where would one learn of bow fishing? books?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
If you can get away with showing forms non-modally, then my suggestion isn't useful.
Another thought that occured to me is that you could use a set of tabbed forms, especially if there are only a few. I expect that you have seen these in use before.
A third idea, which you might get to work in VB6, though I have only used it in .NET on PDA's, is to swap collections of controls into and out of the visibe area on the screen. This is a really sick and twisted idea to do on a desktop, since it would be tough to maintain, but it is kind of fun.
I know Kinzua, there is a nice trail up the east side. Part of the North Country trail, if I remember right. I went to Allegheny college for my BS, so that was pretty local. Did several hikes out in that area.
Originally posted by Dubya007 do this in the main form? that is where the user selects which form he/she is going to use.
Do you start with a Main Sub() or do you start with a form? I put that into a sub called from Sub Main(), though I forget why I didn't just put it in Main().
i start up with a main form. i am not familiar with the tabbed forms idea. could you explain more?
i myself have never been to kinzua dam, but i have been to the bridge plenty of times. i like the bridge alot. but the bridge was hit with a tornado and is torn apart. unfortuneatly the powers that be have decided not to repair it. i live like 10 miles away from the town of alleghany although i think that alleghany college is not in that town is it.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
The tabbed control may be the best possible solution for you. That would be like having many forms open at once, and the user would be able to go from one to the next. If there is a sequence they must follow, this would make little sense, but that doesn't seem to be the case with you.
I didn't know there was a town of Allegheny. The college is in Meadville.
sorry about abadoning yesterday, i had to go try to load some things on another computer. so the tab conrtol allows you to have like 6 forms open on the same form. that sounds like a good idea. that way the user instead of clicking a back button they can just click on a certain tab that will take them to a different screen. is it hard to do in code?
yeah alleghany is a very small town with a university. St. Bonaventure is in alleghany NY. i think that the university is the only reason that the town is even there. it is really close to Olean NY.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
I have worked on some SSTab, here some code for them!
Code:
If rsPlan.EOF = True And rsPlan.BOF = True Then
frmMain.tabMain.TabCaption(7) = "No IPE"
frmMain.tabMain.TabEnabled(7) = False
Else
frmMain.tabMain.TabCaption(7) = "&IPE"
End If
If sServType = "T" Then
frmMain.tabMain.Tab = 5
ElseIf sServType = "E" Then
frmMain.tabMain.Tab = 6
ElseIf sServType = "P" Then
frmMain.tabMain.Tab = 7
Else
frmMain.tabMain.Tab = 7
End If
For i = 1 To tabMain.Tabs - 1
tabMain.TabEnabled(i) = False
Next i
Private Sub tabMain_Click(PreviousTab As Integer)
If tabMain.Tab = "0" Then frmMain.txtLName.text = ""
If tabMain.Tab = "0" Then frmMain.txtFName.text = ""
If tabMain.Tab = "0" Then frmMain.mskSSN.text = ""
If tabMain.Tab = "0" Then frmMain.mskCslr.text = ""
If tabMain.Tab = "0" Then frmMain.mskSSN.SetFocus '''ctk 06/19/2002
If tabMain.TabEnabled(tabMain.Tab) = True And tabMain.Tab <> "0" Then
If tabMain.Tab = 5 Then
If frmMain.lstTWEServices.ListCount = 0 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadPlan
frmSplash.Done
End If
ElseIf tabMain.Tab = 6 Then
If frmMain.lstExtEvalServices.ListCount = 0 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadPlan
frmSplash.Done
End If
ElseIf tabMain.Tab = 7 Then
If frmMain.lstIPEServices.ListCount = 0 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadPlan
frmSplash.Done
End If
ElseIf (tabMain.Tab = 1 Or tabMain.Tab = 2) And Trim(frmMain.rtb208.text) = "" Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
Load208
If Client.Status < "10" Then
frmMain.lbl208.Caption = "Assessment(s) to determine eligibility:"
Else
frmMain.lbl208.Caption = "Assessment(s) to determine extent of rehabilitation needs (counseling, vocational and other):"
End If
frmSplash.Done
ElseIf tabMain.Tab = 4 And frmMain.fgHistory.Rows < 2 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadHistory
frmSplash.Done
ElseIf tabMain.Tab = 8 And frmMain.fgFacServCost.Rows < 3 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadFacServCosts
frmSplash.Done
ElseIf tabMain.Tab = 9 And frmMain.lstCaseExp.ListCount < 3 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
LoadCaseExpenditures
frmSplash.Done
ElseIf tabMain.Tab = 10 And frmMain.fgFinActivity.Rows < 3 Then
Call frmSplash.Display("Inquiry", "Retrieving data. Please be patient... ", frmMain)
FinancialActivity.LoadFinancialActivity
frmSplash.Done
End If
ElseIf tabMain.Tab <> 0 Then
tabMain.TabEnabled(tabMain.Tab) = False
cmdPrint.Enabled = True
End If
End Sub
This is just some code dealing with SSTabs
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway