Loading And Unloading Forms?
Any one have any advice on Loading and Unloading VB Forms?Sometimes a form may take a few seconds to load while establishing a database connection or loading controls
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Loading Unloading Forms
Hello!
I've been working on a basic VisualBasic 6 Cash Register program.
When a user launches the register form, I want to ensure that there is an active cash drawer. I have a variable CDID (CashDrawerID) that is set when the user cashes in. If the CDID = 0 I don't want the Cash Register form to launch. So I used this:
If CDID = 0 Then
MsgBox "No Drawer Open!"
Unload Me
End If
The problem is, I have a "Control Panel" form with 4 buttons, one of them is to start the register:
Private Sub Command1_Click()
frmRegister.Show
End Sub
Of course, when the frmRegister is unloaded due to a missing CDID, I get an error from the Control Panel form, because frmRegister was unloaded.
I guess I'm missing the way that the loading forms and unloading forms work.
What's the best way to remove, but to stll have access to it when you're ready for it. Wouldn't Unload be best for memory use?
Thanks for your help!!!
Unloading And Loading Forms
Hi folks,
I have this problem. I want to unload a form1 and then load Form2. On Form2 I want to unload it again to load Form1.
When i use my menuitem to unload the form everything works perfectly. When the user pressed the cross button to exit from the form it can't be loaded again. How can i make it work like my menu item?
Code:
Private Sub mAfsluiten_Click()
Unload Me
Menu.show vbModal
End Sub
the correct working way but I can't get the cross to work :S
Loading & Unloading Forms
Hello
when i unload a form, what happens to its variables, are they sent into oblivion or are they set to their initial values.
if i were to load, unload and then load the form, are the values set to their initial values as indicated in the load method or do they retain any values attained in between
Loading & Unloading Forms
I know this is a reeeeaaaally basic question and probably sounds stupid, but here it goes. I've designed an application that runs from one VB form. I have an About menu that brings of a splash screen. When the user clicks the About menu option from the main form, I want the splash screen to load and the main form hidden.
Wouldn't I just do something like this in the About menu click_event?:
frmMain.hide
frmSplash.load
These aren't working for me. What's wrong??
Thanks!!
Loading/Unloading Forms
Is it just me, or has anyone else had this problem .....
When I am in debug mode, stepping thru code with F8, if I hit a line of code that loads & shows a new form the debug stops !
Also sometimes, when I put a break in, if I press F5 half my code doesn't execute. I end up in situations where the right form is on the screen, but no code has been executed to populate my textboxes etc.
I have code that switches from screen 1 to screen 2. When the user presses a button that switches back to screen 1, it runs the code in 'Form Activate', which ends up with some text variables being empty, but if I run in debug they are not !!!!?!?!?!!
I am accessing RMS files across a network, so it could well be down to some sort of timing problem !?!!
I hope I have explained myself enough, and someone can let me know why this happens, because trying to trap this problem is proving difficult.
Thanks a lot.
Loading And Unloading Forms
I have a vb6 app that has dozens of forms.
I am experiencing an problem where I finish the code on one form,
unload formA and formB.show
I am seeing where if the unload and show are in an if statement, then I will go to the new form and when it gets to the end of the load routine, the code will take me back to the previous forms if statement.
Why is this happening and how do I avoid it?
I am wondering if I need an Exit Sub after each form.show line.
I've pasted all of the code from one test and the problem is at the very last sub routine (I think)
all code follows...
Option Explicit
Private iPassCount As Integer
Private bPassOn As Boolean
Private bFailed As Boolean
Private bPassed As Boolean
Private bFailButtonOff As Boolean
Private iStatustemp As Integer
Private Sub PassTest()
If bPassed = True Then Exit Sub
bPassed = True
SoundHorn
tmrSequence.Enabled = True
End Sub
Private Sub cmdCanBusDebug_Click()
frmCanDebug.Show
End Sub
Private Sub FailTest()
If bFailed = True Then Exit Sub
SoundHorn
bFailed = True
' Capture Failure Code
If Len(sFailCodes) > 0 Then
sFailCodes = sFailCodes & "F10" & ","
Else
sFailCodes = "F10" & ","
End If
tmrSequence.Enabled = True
End Sub
Private Sub cmdTestHelp_Click()
txtHelp.Visible = True
lblHelp.Visible = True
FindHelp ("HazardSwitch")
txtHelp.Text = sHelpText
End Sub
Private Sub Form_Load()
frmMain.Enabled = False
frmHazardSwitch.Top = SCREEN_TOP
frmHazardSwitch.Left = SCREEN_LEFT
frmHazardSwitch.Height = SCREEN_HEIGHT
frmHazardSwitch.Width = SCREEN_WIDTH
tmrSequence.Enabled = False
tmrSequence.Interval = SEQUENCE_TIME
cmdCanBusDebug.Enabled = False
iPassCount = 0
bPassOn = False
txtMessage.BackColor = vbRed
txtMessage.Text = "OFF"
SendDpidRequest
tmrScreenRefresh.Enabled = True
frmHazardSwitch.Show
frmHazardSwitch.SetFocus
frmHazardSwitch.KeyPreview = True
txtHelp.Visible = False
lblHelp.Visible = False
bFailed = False
bPassed = False
bPassOn = False
bFailButtonOff = False
bDebugMode = False
sTestAborted = "HazrdSw"
DoTest
End Sub
Private Sub SendDpidRequest()
NeoVITransmit "244", 1, 8, "03", "AA", "04", "03", "00", "00", "00", "00"
End Sub
Private Sub DoTest()
If bDebugMode = True Then Exit Sub
iStatustemp = (ReadByte("544", 1, "3", 3))
If iStatustemp = 0 Then SendDpidRequest
If BitTestA(iStatustemp, 2) = True Then iPassCount = iPassCount + 1
If iPassCount >= 2 Then
bPassOn = True
txtMessage.BackColor = vbGreen
txtMessage.Text = "ON"
End If
If (bPassOn = True) And (BitTestA(iStatustemp, 2) = False) Then PassTest
tmrScreenRefresh.Enabled = True
End Sub
Private Sub tmrScreenRefresh_Timer()
HolderQuickCheck
tmrScreenRefresh.Enabled = False
If bTesterFaulted = True Then
tmrSequence.Enabled = False
Unload frmHazardSwitch
EndCurrentTest
Exit Sub
End If
If sCurrentUser = "Engineer" Then
cmdCanBusDebug.Enabled = True
Else
cmdCanBusDebug.Enabled = False
End If
If bDebugMode = True Then Exit Sub
If frmMain.EnetOpto.InputStatus(15) = False Then bFailButtonOff = True
If (bFailButtonOff = True) And (frmMain.EnetOpto.InputStatus(15) = True) Then FailTest
DoTest
End Sub
Private Sub tmrSequence_Timer()
tmrScreenRefresh.Enabled = False
tmrSequence.Enabled = False
'NeoVITransmit "244", 1, 8, "04", "AA", "00", "03", "00", "00", "00", "00"
NeoVITransmit "244", 1, 8, "03", "AA", "00", "03", "00", "00", "00", "00"
PrepC68 'GMLan Commands Sent to C68 Controller to get ready for C68 Door Test
Unload frmHazardSwitch
If
Loading And Unloading Forms
VB6. When selecting from drop down menu options I display different forms by
using the Load (filename) and leave the form with Unload(Filename)
The Load event allows me to program the opening of a particular direct
access file and the Unload event lets me program the closing of the file.
Things are kept 'tidy' this way.
My problem is that I want to pass in a parameter when a particular form
loads. This will control which record is to be displayed. I want Pointer
to come in as a parameter.
Eg Seek #1, Pointer
Get #1, , MembRec
How do I do this?
Your help is appreciated
Geoff
Loading / Unloading Forms Quickly
Hey, well I am currently making a game in which when the users player moves to a certain place on the form that form is made invisible, and the next form is shown, however there is always a small loading time ( around half a second ) although it doesnt sound like much it is annoying.
Is there anyway of making this quicker?
I tried preloading the forms first like this so i could just set the visibility to true but it still lagged
Code:
Load frm1
Load frm1
frm1.visible = false
frm2.visible = false
Loading And Unloading Forms (Resolved!)
I have an app that starts in Sub Main by checking to see if the app is already running, and if not, it loads the splash form
Code:
Private Sub Main()
If App.PrevInstance Then
End
Else
frmSplash.Show
End If
End Sub
the splash form will hide after 10 seconds or if the user clicks on it, and then Loads MainForm---
Code:
Private Sub Form_Load()
'do a bunch of waiting and stuff
Load Mainfrm
End Sub
and in the Load MainForm event I unload frmSplash
Code:
Private Sub Form_Load()
Unload frmSplash
'do a bunch more stuff
End Sub
my problem is that Sub Main never completes and when I unload frmSplash, I get an "Object was Unloaded error"
How do I get around this, OnError Resume Next??????
kevin
Loading/Unloading Forms Problem
Form A loads a small form modally (Form B).
When the 'PROCEED' button on Form B is pressed the following happens :
Form B is unloaded
Form C is shown
Form A is hidden.
Try as I might, using combinations of .REFRESH on the forms and that old favourite 'DoEvents', I ALWAYS get delay of 3 seconds or so before Form B disappears from screen and Form C is properly 'drawn'.
Any ideas anyone ? Hope that all made sense
Steve.
Loading / Unloading Forms Lil Prob
Hey all,
I got and app, its multiuser and multi windowed.
from the main window (w1) you can call up another window (w2).
W2 has on form load and on form unload event handlers...
all ok so far...
however when I call W2 the first time from W1 (using W2.Show)the on load and on unload work (i use Unload me), the second time I call it from W1 it doesnt perform the on load event!!
is there any way of forcing the onload event to run everytime the window is called/shown??
BTW its snowing here in sunny Buckinghamshire
Nit
Auto Loading And Unloading Of Forms After A Period Of Time
I have two forms that I want to load alternatively to give time results, they are called results.frm and results1.frm. I would like to load results and display it for 15 seconds, and then unload results and load results1 for 15 seconds, then go back to results, etc continuous. These forms automatically populate from CSV files when they load so I need to run the populate routine every time each form loads.
Here is what I want to do:
Load Results
Results.Show (vbModal)
Delay 10
Unload Results
Load Results1
Results1.Show(vbModal)
Delay 10
Unload Results1
Then start over again. I thought this would be a simple thing but I am having trouble figuring it out.
Loading/Unloading
My program has transperancy and i want like a check box in options saying enable transperancy.How do i make it if its checked or not checked to open the same way every time?
Unloading And Loading
How Do I unload and app and then I want to load the aplication againg. I developed and multi-enterprise app and and I need to change between them.
Thanks...
Form Loading/unloading
Hi, I´m having some problems while loading some forms in my VBA application. The problem is that whenever I load two different forms at different times, from the main form (Application window) the second time I open the same form the application freezes displaying the form window with a blank white background.
After that I have to use the task manager to close the application..
The code I´m using on the main form is:
Code:
Me.Hide
frmSecond.Show
Then I have a return command button on the "Second" form:
Code:
Me.Hide
frmMain.Show
I´ve also tried to use this:
Code:
Unload Me
frmSecond.Show
But it seems to get the application even more unstable while switching trough forms. Am I doing something wrong and is there a better way to load/unload forms ?
Thank you!
Unloading Form While Loading...
Hello!
I have a main form and another form.
Now in main form user clicks on a button which takes him to a form called frmHoho.
Now in frmHoho's Load event there's a check like:
If DatabaseExist = False then Unload Me
Now when ever the form unloads it gives a error:
Runtime Error '364':
Object was unloaded
How to resolve this problem..i mean...how can i unload the form during load.
Thanks!
Form Loading And Unloading
I am creating an application that uses several forms. My question is, would it be better to create all the forms at the initial start of the program and then hide each form that is not being used and then unload all the forms once the application is terminated? or would it be better to load each form as needed and then unload the form when the form is no longer in use? Are there any advantages or disadvantages to either method?
Loading/unloading Or Hiding
hey guys.
I am confused.
ok basically I unload a form, and show another form2. from form2 if there is an error it goes back to form1, but it says its "unloaded'.
I even put
VB Code:
Form9.HideLoad frmSplashfrmSplash.Show
and when i press debug it highights the LOAD line.
I could use hide/show but when i show it again, the 'form' isnt started all over it. i want to start Form_load event over it
how can i fix this.
Unloading A Form While Loading
I have forms in my application..While loading a form..i checked fr some parameters..if they are not provided i pop up a window to the user..how ever what i want is to unlaod that form and display a message to the user..can any one tell me about that..thanx
Unloading And Loading A Control.
I have a TreeView control on my form and I wish to completely unload it from memory and and place a new TreeView control in its place (With the same name). The unload command does not apply here from what I've seen. How would I got about accomplishing this?
Form Loading/unloading In VB.NET
ok..it got weird. as far as i know, i have to define a variable to hold the form, then call the Form.Show.
so
Dim F as New frmMain
F.Show
but since it's Dim, does the form die once the procedure is over? That would be a bit useless...
And how do i terminate the form? (ie: replacement ofr Unload frmMain)
thanks
-C
Loading And Unloading ActiveX DLL's
OK, I wonder if any of you clever peeps can throw some light on this idea I have please.
It is my intention to have a "manager" app that will load (and unload) other smaller "plug-in" apps as and when the user requires them. This will enable me to issue the "plug-in" apps on an ongoing basis. I would rather the app not load ALL possible plug-ins at loadtime to save on resources.
I chose to use .DLL's over .EXE's as I hoped that the use of .DLL's would allow me to share common functions and data between the "manager" and "plug-in" apps.
Should I expect this to be acheivable in VB6?
I have tried to load (and unload) very simple ActiveX DLL's from my "manager" VB app to no avail I have looked around these forums and elsewhere and I am using the loadlibrary function from Kernel32 but whenever I try to access the DLL functions I get the "Cannot find entry point".
How should I load(& unload) the ActiveX DLL's and how should I call functions in those ActiveX DLL's from within VB?
Any help/pointers would be very much appreciated.
Many thanks
Ever so slightly Confused
Unloading And Loading Crappy Error :( Help!!!
Hello everyone,
I'm just having a crappy day today! Because this little error is really making me mad. Well i've been working on a MMORPG for awhile now and i'm programming the load screen where you log on it dosnt use DirectX but the rest of the program uses DirectX. I'm making for frmLogin do somthing like this...
Private Sub imgContinue_Click()
Load frmMain
If ConnErr = True Then
MsgBox "Error connecting to server, please check your connection or try afain in a few minutes.
ElseIf ConnErr = False Then
End If
End Sub
My frmMain Load routine goes through the basic check connection and if connected then start the main program and then it goes to full screen and you can play the game fine untill you escape and then when you escape it shows an error:
Runtime Error 364:
Object was Unloaded
Then it highlights Load frmMain in my imgContinue Sub Routine
I also have unloaded frmMain in other places of my program.
I have tried to reverse it and turn Form_Load in frmMain into a Public sub but then it ignores my Private Functions when I call it from my frmLogin.
Please help!! How can I load frmMain without this error and have all my Functions work correctly?
Long Loading And Unloading Delays
I've been working on a level editor in vb for a while now. Just recently it started taking a long time to load and unload.
I set a breakpoint at my first executable statement and it took 5 min to get to it. It also took 5 min to unload.
Is this normal? What are some causes of this and how can I fix them?
Loading/Unloading Controls At Run-time
I am using the following:
VB Code:
Public Sub CreatePictureBox() ControlNumber For m_intIndex = 1 To m_intContolNumber With frmMain Load .pb(m_intIndex) Set .pb(m_intIndex).Container = .picWorkArea End With With frmMain.pb(m_intIndex) .Visible = True .Top = 50 .Left = 50 .Height = 500 .Width = 500 .Appearance = 0 .BorderStyle = 1 End With Next m_intIndexEnd Sub
Let's say that I wanted to "delete" this control, that would then be unloading right? Therefore, because I "Loaded" the control from an existing one, does that mean I can "Unload" it too?
For example:
Load .pb(m_intIndex) 'loads the picturebox
Unload .pb(m_intIndex) 'delete/unload it?
Thanks in advance.
Slide The Form While Loading/unloading
Hi
I used to make a timer with about 15 intereval and write in it this code
sub load_form()
me.width=0
me.hight=0
end sub
sub .._timer1
me.hight=me.hight+100
me.wighth=me.width +100
if me.hight > 5000 then timer1.enabled=false
end sub
but it's performance slow on some old computers like pintium 233
So any other profissional way
Sorry for this bad code language bczz i don't have vb installed here on this com.
Loading/Unloading Arrayed Labels
Ok, here's the deal: i am creating a minesweeper game, and I have to use a load function to create the gameboard. so here's what i have:
VB Code:
For i = 1 To 8 For j = 1 To 8 Load lblMines(n) lblMines(n).Top = t lblMines(n).Left = l l = l + w lblMines(n).Visible = True n = n + 1 Next j
the code works and all, but the thing is, when i want to create a new game, i call the function that has this code in it, but it says that 'Object already Loaded' pointing towards the Load lblMines(n) line. I know what the problem is, my only question is I want to know how to Unload lblMines(n) so I can re-create it without adding a bunch of code.
Help Me For Loading An Unloading Controls Dynamically
I'm trying to create an application like EditPlus(a code editor) where the user is allowed to open multiple files...
In that process I'm stuck witha problem
I have a tab control on the form and whenever the user opens a file, a new text box gets loaded and the tab number increases. but suppose the user opens 4 files (he then has 4 tabs)...
but if he closes the second file.... I could not rearrange the 3, 4 th text boxes to 2nd and 3rd respectively, as the Index property is readonly. (Where as if a tab is removed, they rearrange themselves). How could I go about it?
Thanks
VJ
Loading And Unloading Labels -> Error
I try to make a control in vb6 which had two columns labels in it and a scrollbar. so I inserted two labels, lblTaal1 and lblTaal2, and a scrollbar.
I want the control to load as much labels as fit in the control.
behind the control I use this code:
Code:
Private IndexLoaded As Integer
Private Sub UserControl_Initialize()
UserControl_Resize
End Sub
Private Sub UserControl_Resize()
A& = UserControl.Height / 240
UserControl.Height = A& * 240
VScroll1.Height = UserControl.Height
VScroll1.Left = UserControl.Width - VScroll1.Width
'MsgBox lbltaal1.Count
'MsgBox lbltaal1.LBound
'MsgBox lbltaal1.UBound
For z = 1 To IndexLoaded - 1
Unload lbltaal1(z)
Unload lbltaal2(z)
Next z
For z = 1 To A& - 1
Load lbltaal1(z)
lbltaal1(z).Top = z * 240
lbltaal1(z).Left = lbltaal1(0).Left
Load lbltaal2(z)
lbltaal2(z).Top = z * 240
lbltaal2(z).Left = lbltaal2(0).Left
Next z
IndexLoaded = z
End Sub
at 'Unload lbltaal1(z)' I get the error: "Unable to unload within this context". why this error, and how to fix it.
VisualPenguin
Loading And Unloading Of DLLs In VB Application
--Boundary_(ID_dwu8mSQq8LicAkqjqQHiOQ)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT
Hi all,
I m trying to create an application in VB. It is an MDI form with child
forms to perform related operations.
What I want exactly is - to create a small EXE which will only have the
blank MDI with menu and toolbar on it. As I click on menu options,
accordingly related ActiveX DLLs (which will have the related form and
the class module) should get loaded and when I select other menu
options, unwanted DLLs which were loaded due to previous menu options
should get unloaded, thereby saving memory occupied by the application.
I want to use this approach as this approach reduces the EXE file size
and hence the loading and execution time. Also it is very easy to
maintain, since whenever I need to upgrade my system, I need to upgrade
only the DLL and not the entire EXE.
My problem is I am not able to attach DLL to the main EXE as it gives me
error that "no MDI available".
If I DONT set forms MDIChild property to TRUE it works well, but it does
not behave as Child for the main MDI form. And if I set the MDIChild
property to TRUE - it gives error saying "No MDI form available to
load".
Is there any other efficient approach to achieve this solution.
Regards,
MRL
--Boundary_(ID_dwu8mSQq8LicAkqjqQHiOQ)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Message</TITLE>
<META content="MSHTML 5.00.3502.5390" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT color=#0000ff face=Arial size=2>Hi all,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2>I m trying to create an application
in VB. It is an MDI form with child forms to perform related operations.
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2>What I want exactly is - to create a
small EXE which will only have the blank MDI with menu and toolbar on it. As I
click on menu options, accordingly related ActiveX DLLs (which will have the
related form and the class module) should get loaded and when I select other
menu options, unwanted DLLs which were loaded due to previous menu options
should get unloaded, thereby saving memory occupied by the application. I want
to use this approach as this approach reduces the EXE file size and hence the
loading and execution time. Also it is very easy to maintain, since whenever I
need to upgrade my system, I need to upgrade only the DLL and not the entire
EXE.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2>My problem is I am not able to attach
DLL to the main EXE as it gives me error that "no MDI available".<BR>If I DONT
set forms MDIChild property to TRUE it works well, but it does not behave as
Child for the main MDI form. And if I set the MDIChild property to TRUE -
it gives error saying "No MDI form available to load".</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2>Is there any other efficient approach
to achieve this solution.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2>Regards,<BR>MRL</FONT><FONT
color=#0000ff face=Arial size=2><BR></FONT></DIV></BODY></HTML>
--Boundary_(ID_dwu8mSQq8LicAkqjqQHiOQ)--
Compeltely Unloading And Re-loading A Form
i have a form that gains some information from a database. On click of a certain command button a database entry is deleted so that a particular object won't appear on the screen when the form is loaded next. however i want the form to reload completly after the entry is deleted so all my Form_Load declarations etc. are present but all the objects,variables are cleared before hand so its like the form has just been loaded for the first time. any suggestions?
Problem Loading And Unloading Userforms
Hullo,
It's late in the day, and I have a problem with the loading/unloading of a form.
My form has a bunch of checkboxes on it, and in my Initialize procedure, I set them all to false.
The form has OK and Cancel buttons, and at the end of the associated processes, the form is hidden and then unloaded.
But if I check a couple of the boxes and then run the OK or cancel process, and then re-run the process which loads the form, the checkboxes I checked on the last iteration are still checked. Stepping through the code shows that the Load line isn't running when I go through the code a second time. I'm scratching my head now, so I could use a pointer on this!
Where I run the code to load/start the form:
Code:
Sub MyTest
Load MyForm
MyForm.Show
End Sub
The associated initialization:
Code:
Private Sub UserForm_Initialize()
MyForm.Check1=False
MyForm.Check2=False
MyForm.Check3=False
End Sub
Now for the associated Cancel and Ok procedures.
Code:
Private Sub Cancel_Button_Click()
MsgBox ("Process cancelled.")
MyForm.Hide
Unload MyForm
End Sub
Private Sub OK_Button_Click()
'Do Stuff
'...
MyForm.Hide
Unload MyForm
End Sub
So say I run it (MyTest) the first time, check boxes 1 and 2 and then click OK (the "Do Stuff" bit works fine!).
Now I run MyTest again, and check boxes 1 and 2 are checked - the initialize procedure hasn't run!
Eh?
Cheers,
Matt
-------------------------------------------------------------------------------
"That's why it's always worth having a few philosophers around the place. One minute it's all Is Truth Beauty and Is Beauty Truth, and Does A Falling Tree in the Forest Make A Sound if There's No one There to Hear It, and then just when you think they're going to start dribbling one of 'em says, Incidentally, putting a thirty-foot parabolic reflector on a high place to shoot the rays of the sun at an enemy's ships would be a very interesting demonstration of optical principles."
(Terry Pratchett, Small Gods)
Unloading And Loading A Tree View Control.
I have a TreeView control on my form and I wish to completely unload it from memory and and place a new TreeView control in its place (With the same name). The unload command does not apply here from what I've seen. How would I got about accomplishing this?
Loading And Unloading In A Label Control Array
This is the program that I am trying to duplicate. The problem that I am having is the loading and unloading of the labels in the control array when the vsb's are clicked. The .visible property is not an option as i have to load and unload the labels. I got them to load properly in the form initialization but when i try to load or unload them it says that The object is already loaded. The program is trying to load all of the instances of the label again instead of just adding new ones.
This is the code that im working with:
Private Sub addandsubtract()
Dim mintLeft As Single
Dim mintTop As Single
Dim mintWidth As Single
Dim mintHeigt As Single
Dim i As Integer
mintLeft = lblPixel(0).Left 'Define and position the controls.
mintTop = lblPixel(i).Top
mintWidth = lblPixel(i).Width
mintHeigt = lblPixel(i).Height
For i = 1 To vsbHeight.Value * vsbWidth.Value - 1 'Create the controls.
Load lblPixel(i)
If i Mod vsbWidth.Value = 0 Then
mintLeft = lblPixel(0).Left 'Start a new row.
mintTop = mintTop + mintHeigt
Else
mintLeft = mintLeft + mintWidth
End If
lblPixel(i).Move mintLeft, mintTop, mintWidth, mintHeigt
lblPixel(i).Visible = True
lblPixel(i).Caption = i
Next i
lblPixel(0).Caption = "0"
End Sub
Any Help would be much appreciated
Thanks
Popup Menu Loading Menus But How Unloading?
I have a treeview that I load with data to each node and potential menu data that is hided until the user right-click on a node. This is done when I initialize a userform. Then when a user right-click the a popup menu show a specific data conected to a node in the treeview. My problem is that how do I unload or check if the menu's are loaded? When the userform with the treeview is loaded the user can re-load the treeview (the user wants a different resolution) but then I need to initilize the treeview again and reload the treeview from the database. The problem is then that the menus are already loaded. How can I unload them without unload the whole userform where I've got the treeview and the menus. Or can I check if a menu is loaded so I do not try to do it again.
VB.load mnuDescription(1)
mnuDescription(1).Visible = True
mnuDescription(1).Caption = ""
load mnuDescription(m_rs("MetaDataId"))
mnuDescription(m_rs("MetaDataId")).Caption = m_rs("Description")
mnuDescription(m_rs("MetaDataId")).Visible = False
My second problem is that I would like to make several right-clicks without left-clicking. seems to be complicated without API programming if I understood right after reading other messages on this forum
Loading/unloading Objects In A Control Array
I have a control array of shapes using another array as a sort of point to another piece of information.
I use a counter to tell the Control array to
Load Shape(counter)
The problem is that when I unload a shape, the counter decriments, and when I want to load a new Shape, it tries to load a shape that already exists.
Is there a way to Fill in any gaps in the Control Array at runtime? I already have 4 or 5 pointers and functions pointing around, I don't want to have to throw a stack in the mix as well.
Thanks in advance
Help Needed Regarding Loading And Unloading Images During Runtime
hi all
I am doing an application in VB6 in which i have a Shape,Image (index property set to 0) and a ComboBox(in which i have some numbers starting from 1 to 20)
after the form is loaded i select a number from the ComboBox.
Then that many number of images are loaded in the shape.
till now its working fine.
But when i select another value from ComboBox an error "Unable to unload within this context" is being displayed.
The code for loading and Unloading of images is written in Combo_click event.i want it in click event.
so that when i select numbers inthe combo box that many images are to be displayed.
can someone help me with code
thanks in advance
regards
Rajmv
Dynamic Unloading/Loading Of Controls - VERY Slow, SECOND Time Only ...[NOT RESOLVED]
On the form in question, I have a custom 6-month calendar view, using a control array of 252 labels as the "day boxes". Superimposed on the day boxes are other smaller, thinner labels with their backcolors set to specific colors representing the type of appointment for a given day. These "color strip" labels are loaded/unloaded dynamically as needed.
The problem: The very first time the form loads, it is fast. On the form, there is functionality to change the date range, which causes the same logic that originally loaded the form to be executed. (i.e., unload all the controls that were dynamically loaded, and reload the appropriate controls, based on what is scheduled for the date range). It works, but VERY SLOW - we're talking two-three minutes at least.
However, if I close the form, then re-open it (which the app can do from another form), it is FAST again!
What could be problem?
Unloading The Forms
when i am loading form1 i check if a variable loaded from the registry is empty or not.
if its empty then i do
Code:
Form1.Show 'just so you can see the form
Form2.Show vbModal
now form2 is loaded, if you press the "X" to unload form2, how do you unload form1 aswell ?
i tried this but it just hangs.
Code:
Dim frm As Form
For Each frm In Forms
Unload frm
Next frm
thank you.
casey.
Unloading Forms
Is there a way that i can tell if another form1 is opened when trying to close down form2?
here's what I tried but with no luck, any ideas?
Code:
If FrmWaitingList.Show = True Then
Unload frmNewChild
Else
Unload frmNewChild
frmMain.Show
End If
Unloading Forms
When I unload a form, should I always set it = Nothing? What are the advantages and are there potential dangers to doing so?
thanks, Ted
Unloading Forms In VB6
Hello,
Here is the senario....I have 2 Forms(Form A and Form B)
'A' is the active form, 'B' is opened in the background.
When i close 'A' i would like to close 'B' if it is open.
Currently i am attempting to the UNLOAD command and that doesnt seem to work.....it opens a new instance of the form and closes that one.
Does anyone have any suggestions? Thanks for any help.
Unloading Forms
hi, i am doing a really big app that has 11 forms so far. In the interest of code and being quite lazy, is there any way of unloading all these forms without doin end or unloading each form by name
like i thought of doing
dim x as form
unload form
but this came up with an error, thanks for any help
matrixhacker
Unloading Forms !!
something strange !!
i have 4 form in my Program !!
when i close 1st form ..... then all visible form's of that program must close......... but this dont happen's it iggies..............
i want that if i close 1st form .... then
from 2, 3, 4 must close when form 1 is closing !!
ty every 1
Unloading Forms
I have two blocks of code as shown below.
(The code inside really has nothing to do with this post.)
vb Code:
Public Sub Form_Unload(Cancel As Integer) Clear_Array Set frmBot.Winsock = Nothing Set frmIRC.IRC = Nothing Set frmIRC.IRCsock = NothingEnd Sub Public Sub CloseProgram() Dim frm As Forms ' Call the Form_Unload event for every form. For Each frm In Forms Unload frm Next ' Delete the system tray icon. DelTray EndEnd Sub
When some functions error out they call CloseProgram, which unloads all of the forms, but I noticed that my Form_Unload has (Cancel As Integer) in it. How is my program unloading the form if it requires a variable but is not sent one? Does that For Each loop just unload the form and not the Form_Unload function?
Unloading Forms
Hi,
I am a newbie to .net from VB6 (where I was a newbie to ) and am having some problems unloading forms. My program involves a lot of showing and hiding forms. It appears as though vb.net 2005 pro doesnt seem to allow the 'unload' command anymore so I was wondering how I get my hidden forms out of memory when my program exits?
VB Code:
Public Class frmLogin Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOk.Click If txtUsername.Text = "Username" And txtPassword.Text = "Password" And CbxTerms.Checked = "true" Then Me.Visible = False frmCat.Visible = True ElseIf CbxTerms.Checked = "False" Then MessageBox.Show("You must agree to the terms of use." & vbCrLf & "If you are not aware of these, please contact the network administrator.", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("There was a problem with the username or password entered.", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Information) End IfEnd SubEnd Class
For example in this if I have a close button on my frmCat form how do I get frmLogin to Close aswell? I have tried to close() the frmLogin form instead of hide it but then the frmCat doesnt show up.
|