Solved

Problems with Generated Forms Unloading and Updating

Posted on 2006-07-16
8
223 Views
Last Modified: 2010-04-30
Problems with Generated Forms

Hey Experts

I have a problem with updating and unloading a generated form the code I use to generate the form is

Dim FrmBillInfo As FrmBillInfo
Set FrmBillInfo = New FrmBillInfo

And the code I use to unload the form is

If Answer = vbYes Then
billtotal = 0
Unload FrmBillInfo
Unload Me
Load frmMain
End If

And the form FrmBillInfo has a listview box and I use the following code to update the listview box

Private Sub GetItems()

Dim Rownumber As Integer

Open App.Path & "\Temp\" & FormID & " " & "Items" For Input As #1

Do While Not EOF(1)

        'Fill in the values from our sequential file...
        Line Input #1, BillPart1
        Line Input #1, BillPart2
        Line Input #1, BillPart3
        Line Input #1, BillPart4
       
        Rownumber = Rownumber + 1
       
        'Now add them in the appropriate place...
        lstBillInfo.ListItems.Add
        lstBillInfo.ListItems.Item(Rownumber).SubItems(1) = BillPart1
        lstBillInfo.ListItems.Item(Rownumber).SubItems(2) = BillPart2
        lstBillInfo.ListItems.Item(Rownumber).SubItems(3) = BillPart3
        lstBillInfo.ListItems.Item(Rownumber).SubItems(4) = BillPart4
       
    Loop

Close #1

But none of the code seems to work the listview box remains blank and the form does not unload when the unload frmBillinfo gets executed and then visual basic crashes when I try to exit my application

Please Help

Nothern_Lights
0
Comment
Question by:Nothern_Lights
  • 4
  • 2
  • 2
8 Comments
 
LVL 9

Expert Comment

by:justchat_1
ID: 17117409
This line doesnt trigger an error:
Dim FrmBillInfo As FrmBillInfo

They should have different names...
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17117428
Hi  Nothern_Lights
Addition to what justchat_1 suggested and on the line where you unload the form :

Unload Me
Load frmMain

In this case the form you are trying to unload reloads because there is still code to be executed. Try to switch the lines and make the unload of form the last statement:

Load frmMain
Unload Me
0
 

Author Comment

by:Nothern_Lights
ID: 17117664
Hi I have another problem with lblTotal caption in frmSaleToClientMain is not updating

The code I use to generate the form is

Dim SaleToClientMain As frmSaleToClientMain
Set SaleToClientMain = New frmSaleToClientMain

And the lblTotal.caption gets updated in another form called FrmService which is generated using the code

Dim Service As FrmService
Set Service = New FrmService

and the code to update the lbltotal.caption in frmsaletoclientmain is

frmSaleToClientMain.lblTotal.Caption = lblTotal.Caption

But the caption in frmsaletoclientmain does not update for some reason please help

Nothern_Lights
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 9

Expert Comment

by:justchat_1
ID: 17117701
this line is incorrect:
frmSaleToClientMain.lblTotal.Caption = lblTotal.Caption

You are setting lbltotak's caption to itself...which form is lblcaption located on and where would you like the caption to come from...
0
 
LVL 9

Expert Comment

by:justchat_1
ID: 17117703
* You are setting lbltotal's caption to itself
0
 

Author Comment

by:Nothern_Lights
ID: 17117709
No there is a label called lblTotal in FrmService and another lblTotal in FrmSaletoclientMain

So i thought just copy the text in FrmService to FrmSaleToClientMain by using

frmSaleToClientMain.lblTotal.Caption = lblTotal.Caption

Becuase the code is getting executed in FrmService
 
0
 
LVL 9

Accepted Solution

by:
justchat_1 earned 500 total points
ID: 17117725
thats not what you said before thats why I was confused:
"and the code to update the lbltotal.caption in frmsaletoclientmain is "

try adding a doevents after that line
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17118935
Hi
>>> Dim SaleToClientMain As frmSaleToClientMain

The form instance now is named SaleToClientMain so change the following:
frmSaleToClientMain.lblTotal.Caption = lblTotal.Caption

To:
SaleToClientMain.lblTotal.Caption = lblTotal.Caption
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 64
passing a value with stream reader AFTER a ";" 3 74
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 58
Recommendation vb6 to vb.net or others 14 176
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question