Prev: Error 30366 in VB code behind Visual Studio 2005 project
Next: Referencing Flash OCX properly in vb6
From: M Wade on 7 Apr 2010 15:56 I have a form that contains several frames that are displayed or hidden under certain situations. One specific frame (fraProvider) is giving me problems. The frame is set to False in the properties. When I run the program normally the frame remains visible. If I step through the code the frame becomes invisible. The code is located in a sub and this is all that is in it. I assume it has to do with timing but I use this type of thing numerous time and this is the only time I have had a problem with it. Do I need to do something to slow down the execution and if so what? ' when a provider name is clicked move it to the text box and hide ' the list box txtProvider = lstProvider.List(lstProvider.ListIndex) mProvArrayPos = lstProvider.ItemData(lstProvider.ListIndex) fraProvider.Visible = False Refresh If gMenuChoice = 5 Then ' new Invoice txtBilled(0).SetFocus ElseIf gMenuChoice = 3 Then ' Initial payment ' give focus to the amount field txtInitialPay.SetFocus Else: Stop End If
From: Jeff Johnson on 7 Apr 2010 16:10 "M Wade" <nowhere(a)columbus.rr.com> wrote in message news:%23Uf2ixo1KHA.5328(a)TK2MSFTNGP04.phx.gbl... >I have a form that contains several frames that are displayed or hidden >under certain situations. One specific frame (fraProvider) is giving me >problems. The frame is set to False in the properties. When I run > the program normally the frame remains visible. If I step through the > code the frame becomes invisible. The code is located in a sub and this > is all that is in it. I assume it has to do with timing but > I use this type of thing numerous time and this is the only time I have > had a problem with it. Do I need to do something to slow down the > execution and if so what? > > ' when a provider name is clicked move it to the text box and hide > ' the list box > txtProvider = lstProvider.List(lstProvider.ListIndex) > mProvArrayPos = lstProvider.ItemData(lstProvider.ListIndex) > > fraProvider.Visible = False > Refresh > > If gMenuChoice = 5 Then ' new Invoice > txtBilled(0).SetFocus > ElseIf gMenuChoice = 3 Then ' Initial payment > ' give focus to the amount field > txtInitialPay.SetFocus > Else: Stop > End If You need to search the rest of your code for any time you're setting Visible = True on that group box. Perhaps that code is getting called immediately after setting Visible to False.
From: Larry Serflaten on 7 Apr 2010 17:44 "Jeff Johnson" <i.get(a)enough.spam> wrote > >I have a form that contains several frames that are displayed or hidden > >under certain situations. One specific frame (fraProvider) is giving me > >problems. > You need to search the rest of your code for any time you're setting Visible > = True on that group box. Perhaps that code is getting called immediately > after setting Visible to False. I would think a watch on that property turning True would help quickly find the errant line.... LFS
From: Phil Hunt on 7 Apr 2010 17:33 It happens to me too. It has to do with when the codes is executed, before or after the form is loaded. It is better to have the code after the form is loaded. "M Wade" <nowhere(a)columbus.rr.com> wrote in message news:%23Uf2ixo1KHA.5328(a)TK2MSFTNGP04.phx.gbl... >I have a form that contains several frames that are displayed or hidden >under certain situations. One specific frame (fraProvider) is giving me >problems. The frame is set to False in the properties. When I run > the program normally the frame remains visible. If I step through the > code the frame becomes invisible. The code is located in a sub and this > is all that is in it. I assume it has to do with timing but > I use this type of thing numerous time and this is the only time I have > had a problem with it. Do I need to do something to slow down the > execution and if so what? > > ' when a provider name is clicked move it to the text box and hide > ' the list box > txtProvider = lstProvider.List(lstProvider.ListIndex) > mProvArrayPos = lstProvider.ItemData(lstProvider.ListIndex) > > fraProvider.Visible = False > Refresh > > If gMenuChoice = 5 Then ' new Invoice > txtBilled(0).SetFocus > ElseIf gMenuChoice = 3 Then ' Initial payment > ' give focus to the amount field > txtInitialPay.SetFocus > Else: Stop > End If >
From: GS on 7 Apr 2010 18:39 Typically, this approach implements a structured control mechanism to determine which frame is made visible as a result of some user action. This might be a menu item or a TV node being clicked, for example, and the mechanism sets the visible prop to False for ALL frames and then makes the user action 'trigger' element's frame visible. I use this technique a lot and never encounter what you describe here. I use a single proc to handle the display and pass it the index of which frame to make visible. This precludes that you use a frames array, and your trigger control knows which frame it belongs to. This will also work even if you are jumping to another frame within a frame because the only frame that displays is the one the trigger control passes the index for. What guarantees this is that BEFORE any frame is made visible ALL FRAMES ARE **ALWAYS** HIDDEN. The easiest implementation is using a treeview and having the frames array 'syncronized' its Key prop. It's better to store the frame index in the Key prop and convert to an Integer before passing to (OR before using within) the proc that manages the frames display. (air code) Private Sub DisplayFrame(iNdx As Integer) For i = Frame1.LBound To Frame1.UBound Frame1(i).Visible = False Next Frame1(iNdx).Visible = True End Sub HTH -- Garry
|
Next
|
Last
Pages: 1 2 Prev: Error 30366 in VB code behind Visual Studio 2005 project Next: Referencing Flash OCX properly in vb6 |