Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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.

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?

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...

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

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

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

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?

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!!

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/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 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

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 Form In Vb.net
hi to all,

how to load ang unload for in vb.net

ex. in VB6 code

unload form1
form2.show

how to use this code in VB.net


thanks

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 And Unloading Of Forms
How can unload and load the form faster?

cecile

The more u read, the more u do not know

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.

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

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 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

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/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

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 And Unloading Acitive X Controls During Run Time
Hi

I want to load and unload Active X (Crystal Report) control from the form during run time in VB 6.0. I tried LOAD, but I'm getting error.

Can anyone guide me on this.

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

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.

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?

An Error Occurred While Loading 'ThisDocument'. Do You Want To Continue Loading This Proje
When attempting to open a Microsoft Word document programatically using VB 6.0 Active x Dll the following error message titled "Microsoft Visual Basic" appeared

An error occurred while loading 'ThisDocument'. Do you want to continue loading this project?

once i click no it throws an error with no 5981 i have trapped that in the below segment
and if i click yes it opens up and says that " word cannot fire event"

Code: vbCodeOPen
   On Error goto Err_Occured
    If wrdDocument Is Nothing And Not wrdApplication Is Nothing Then
                Set wrdDocument = wrdApplication.Documents.Open(sSourceFilepath)
    End If
Err_Occured:
    MsgBox Err.Description
    MsgBox Err.Number
    If Err.Number = 5981 Or Err.Description = "Method '~' of object '~' failed" Then
        If Not wrdDocument Is Nothing Then
            wrdDocument.Close
            Set wrdDocument = Nothing
            MsgBox "Error Occured while processing documents"
        End If
End Function


once the error is trapped i close the word instance which i created.
but when i tried in windows 98 and word 97 the winword crashes.

and when i process an other good one an MS word instace is already created ?

can anyone please tell me what the problem is and its workaround ?

Error Unloading
i took this code from a forum here !!


Code:
Private Sub Form_Unload(Cancel As Integer)
Dim Response As Integer
Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Title")
If Response = vbYes Then
Unload Me
ElseIf Response = vbNo Then
Me.Refresh
End If
End Sub


in both the cases it unloads the From y ?

Unloading Current Form And Loading New Form
Hi,

I am trying to unload a form while at the same time load a new form. An example follows:

If unload_sw = True then
unload me
load frmTest
End If

When I try this scenario, it will close out the current form but will not load the frmTest. I also tried reversing the to lines of code and it still didn't work. Anyone have any ideas?

Thanks,
Jeff

Error Unloading Form
I get this error when i unload certain forms...why is it so? The error that I get is

run time error '91':
object variable or with block variable not set

How do i close the form without this error?

Error When Unloading A Form
I unload a form, and after that it gaves me an error :
Run time error '364'

Object Was Unloaded

I don't understant...

Error 365 Unloading Controls
Run-time error '365':

Unable to unload within this context




VB Code:
For Counts = (QuestionCounter + 1) To (frmCustomQuestion.frameQuestion.Count)                Unload frmCustomQuestion.txtQ(Counts)                Unload frmCustomQuestion.txtA(Counts)                Unload frmCustomQuestion.frameQuestion(Counts)            Next Counts


When this code runs, txtQ and txtA are text boxes.. They unload.. But the frame that contains them (frameQuestion) will not unload... Anybody got any ideas as to why?

Error Unloading Forms
I am running into occasional problems unloading forms. When running in the environment, I can call "Unload Me" and the form will disappear, but program does not exit out. This problem was solved by (a)removing all With statements or (b)using the End statement. I am not sure why this is necessary. Is there anyone who has found similar problems? Thanks.

Visual Basic 6.0, Service Pack 3

Jay

Error Unloading A Form?!
I’m getting error number 364 (Object was unloaded) when my app returns from showing another form.
It seems the error happens in my child form when I have to exit the form immediately after loading it.
If the form loads and unloads normally I don’t get the error.

Environment: VB6 SP6


Parent Form:

Code:Private Sub cmdEditOrder_Click(Index As Integer)

    On Error GoTo ErrHandler

    Select Case Index
        Case 0
            frmColumnOrder.Show vbModal

        Case 1
            frmBeamOrder.Show vbModal

        Case 2
            frmJoistOrder.Show vbModal

    End Select

    Exit Sub

ErrHandler:

    If Err.Number = 364 Then
        ' Object unloaded
        Resume Next
    End If

End Sub
 

 

Child Form:
 

Code:Private Sub Form_Load()
        ‘ Code removed
        If <condition detected that requires me to close the form> Then
            MsgBox "Problem...Closing Form"
            Unload Me
            Exit Sub
        End If
End Sub
 

Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo ErrHandler
    ‘ Code removed
    Exit Sub

ErrHandler:
    ‘ Code removed
End Sub
 

Can anyone throw any light on this?

What’s the correct way to do this?

I don’t have any error handling in my parent form’s Load event.
Am I supposed to trap this error there?
(Would seem rather odd)


Mac

Copyright © 2005-08 www.BigResource.com, All rights reserved