That is a good explanation of the syndrome. To correct for it, I would suggest using a global variable called stopCascade or something similar: dim stopCascade stopCascade = false
each routine should check for 'and not stopCascade' as well as that the entered value is a valid number before beginning to process. before editing the other textbox, (or any textboxes, just to be on the safe side,) set stopCascade to be true, and then set it to false again when you're finished setting values. This should stop the stack overflows I believe. --- In [email protected], "joespan123" <j...@...> wrote: > > When you place both TextBox1_Change and TextBox3_Change events in your > program they will perform a circular cascade until failure which is a Stack > Overflow error. > > Both TextBox1_Change and TextBox3_Change functions are EVENTS which get > triggered when you make a change in TextBox1 or TextBox3. > > If you change TextBox1 it will trigger TextBox1_Change, the function will > make a change to TextBox3. > > TextBox3 will trigger TextBox3_Change, it will make a change to TextBox1. > > TextBox1 will trigger TextBox1_Change, it will make a change to TextBox3. > > This will repeat forever until you run out of Stack Space. > > > > > --- In [email protected], "Randall Jones" <randalljones@> wrote: > > > > Ya'll, > > > > I don't even know what to think at this point. > > > > I have a small program ... I've written 2 subroutines ... they will > > not co-exist. > > > > Either will work perfectly if alone in the program. > > > > The program fails if they are both present. Even if the other isn't > > used. > > > > Internal application errors and out of stack space errors occur > > immediately after any input. > > > > The subroutines do some simple math and don't call each other or > > anything else. > > > > here they are ... > > > > ====================== > > Sub TextBox1_Change > > If IsNumeric(TextBox1.Text) = True Then > > dbm = TextBox1.Text > > If dbm > 0 Then > > 'Calulate other values from input value > > dbu = dbm + 107 > > dbmv = dbm + 47 > > uv = 10^(dbu/20) > > volt = uv/1000000 > > wat = (10^(dbm/10))*0.001 > > mw = wat * 1000 > > dbw = 10*(Log(wat)/Log(10)) > > dbkw = 10*(Log(wat/1000)/Log(10)) > > > > 'Display values > > TextBox2.Text = Round(dbu, 4) > > TextBox3.Text = Round(wat, 4) > > TextBox4.Text = Round(mw, 4) > > TextBox5.Text = Round(volt, 4) > > TextBox6.Text = Round(dbmv, 4) > > TextBox7.Text = Round(uv, 4) > > TextBox8.Text = Round(dbw, 4) > > TextBox9.Text = Round(dbkw, 4) > > End If > > End If > > End Sub > > > > ========================== > > > > ========================== > > Sub TextBox3_Change > > If IsNumeric(TextBox3.Text) = True Then > > wat = TextBox3.Text > > If wat > 0 Then > > 'Calulate other values from input value > > mw = wat * 1000 > > dbm = 10*(Log(wat/0.001)/Log(10)) > > dbu = dbm + 107 > > dbmv = dbm + 47 > > uv = 10^(dbu/20) > > volt = uv/1000000 > > dbw = 10*(Log(wat)/Log(10)) > > dbkw = 10*(Log(wat/1000)/Log(10)) > > > > TextBox1.Text = Round(dbm, 4) > > TextBox2.Text = Round(dbu, 4) > > TextBox4.Text = Round(mw, 4) > > TextBox5.Text = Round(volt, 4) > > TextBox6.Text = Round(dbmv, 4) > > TextBox7.Text = Round(uv, 4) > > TextBox8.Text = Round(dbw, 4) > > TextBox9.Text = Round(dbkw, 4) > > End If > > End If > > End Sub > > ====================== > > > > At your service ... > > > > Randall Jones > > randalljones@ > > AE7RJ > > > > "We can't solve problems by using the same kind of thinking we used > > when we created them." > > --Albert Einstein (1879-1955) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---
