473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Code after Form.Show

Its been a while since I worked with VB6, so hang with me if this is stupid. How do I get past the Form.show method if I call it in a function? Here is the scenario.

Sub Whatever()
Some Code Here

frmProcess.Show vbModal

Some More Code Here
end sub

I want it to process the "Some More Code Here" portion after the form is shown. But it just shows the form and hangs until I close the form. Then it moves onto the "Some More Code Here" portion.

I tried moving "Some More Code Here" to the form load of frmProcess. The thing with that is once "Some More Code Here" is done, then I don't need the form up anymore. So putting it on form load never shows the form.

Its like I need another thread or something, but I don't think I can do that in VB6, right?

How can I just display the form and move on?
Aug 16 '07 #1
10 5746
Ali Rizwan
925 512MB
Its been a while since I worked with VB6, so hang with me if this is stupid. How do I get past the Form.show method if I call it in a function? Here is the scenario.

Sub Whatever()
Some Code Here

frmProcess.Show vbModal

Some More Code Here
end sub

I want it to process the "Some More Code Here" portion after the form is shown. But it just shows the form and hangs until I close the form. Then it moves onto the "Some More Code Here" portion.

I tried moving "Some More Code Here" to the form load of frmProcess. The thing with that is once "Some More Code Here" is done, then I don't need the form up anymore. So putting it on form load never shows the form.

Its like I need another thread or something, but I don't think I can do that in VB6, right?

How can I just display the form and move on?

I am using this statement now at this time on an database and is doing well i have not found any problem with this code.

Now use this one

Private Sub ()

text1.text=5 (Some code)
frm.Show
frm.text1.text=5 (Some more code)

End Sub

try it if it does not work then i will send u another solution.
Aug 16 '07 #2
Ali,

Thanks for the reply. I tried that code. However, if I remove "vbModal" I get an error. Is that what you were suggesting?
Aug 16 '07 #3
Killer42
8,435 Expert 8TB
... if I remove "vbModal" I get an error ...
Can you give us more detail on the error, such as where it occurs? And when?

When you show a window modally, that means it takes control and doesn't return it until the window is unloaded or (I think) hidden. So there's no getting around the fact that you cannot continue on past the Show statement unless (A) the form is hidden/unloaded, or (B) it is shown non-modally.

I think it is possible to do multiple threads, but don't have any experience with them. It's probably unnecessary in this case, though.
Aug 17 '07 #4
I get 5-Invalid procedure call or argument on the Form.Show.

I also tried this as a work around. I called the frmProcess.Show when my project starts up. Then on the form load of frmProcess, I call me.hide. Then when it is time to show the form, I just call frmProcess.visible = true. I unload the form when I'm done with it. But with this I get a runtime error 402, must close or hide topmost modal form first, when I call the me.hide on the Form Load of frmProcess.
Aug 17 '07 #5
Killer42
8,435 Expert 8TB
I get 5-Invalid procedure call or argument on the Form.Show.

I also tried this as a work around. I called the frmProcess.Show when my project starts up. Then on the form load of frmProcess, I call me.hide. Then when it is time to show the form, I just call frmProcess.visible = true. I unload the form when I'm done with it. But with this I get a runtime error 402, must close or hide topmost modal form first, when I call the me.hide on the Form Load of frmProcess.
Well, I guess that means you're still showing it modally. I don't know, this is sounding quite confusing.

Um... Let's see, if your current form is displayed modally, then you cannot show a non-modal form until you hide or unload it. Maybe that's the problem. I wouldn't have expected "invalid procedure call" though.

By the way, if you want to load the form without showing, it just Load frmProcess. There's no need for the Me.Hide.
Aug 18 '07 #6
Ali Rizwan
925 512MB
Ali,

Thanks for the reply. I tried that code. However, if I remove "vbModal" I get an error. Is that what you were suggesting?
Yeh i am saing to remove vb model.
Because i am using this statement in my application and i have a large number of code on form1 for form 2

You can try the code after form.show on load event of form2.
Aug 18 '07 #7
Ali Rizwan
925 512MB
Ali,

Thanks for the reply. I tried that code. However, if I remove "vbModal" I get an error. Is that what you were suggesting?
Dear Matt
I tried your code you hae given

Some code
frmprocess.show vbModal
Som code here

and i see some code here does not work but when i remove vbmodal then some code here works properly
i have writen this code
Private Sub Command1_Click()

Form1.Caption = "ALI"
Form2.Show
Form2.Caption = "ALI"

End Sub
Aug 18 '07 #8
Well, I guess that means you're still showing it modally. I don't know, this is sounding quite confusing.

Um... Let's see, if your current form is displayed modally, then you cannot show a non-modal form until you hide or unload it. Maybe that's the problem. I wouldn't have expected "invalid procedure call" though.

By the way, if you want to load the form without showing, it just Load frmProcess. There's no need for the Me.Hide.
This project I'm writing is a plug-in to another application. When my application gets called, there is already another form showing from this other application, which I have no control over. I'm guessing that one is being shown modally.
Aug 20 '07 #9

Sub Whatever()
Some Code Here

frmProcess.Show vbModal

Some More Code Here
end sub

I tried moving "Some More Code Here" to the form load of frmProcess. The thing with that is once "Some More Code Here" is done, then I don't need the form up anymore. So putting it on form load never shows the form.
I figured out a work around and it works pretty well. from form1 I call frmProcess.show vbModal. On frmProcess, I implemented a Timer and set the click to 1 second. On form load, I enable the Timer. Then in the timer click I put my "Some More Code Here" code and then unload the form when its complete. This allows the form to actually show and completes the code that I want it to.
Aug 20 '07 #10
Killer42
8,435 Expert 8TB
I figured out a work around and it works pretty well. from form1 I call frmProcess.show vbModal. On frmProcess, I implemented a Timer and set the click to 1 second. On form load, I enable the Timer. Then in the timer click I put my "Some More Code Here" code and then unload the form when its complete. This allows the form to actually show and completes the code that I want it to.
Glad to hear you found a way around it. If you are being called from a modal form, then I'm pretty sure it's not possible to show your form non-modally.
Aug 20 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eric | last post by:
When trying to call form 2 with form2.show or form2.show = true I get this error Run-Time error '424': Object Required I am trying to call form 2 from form 1. I am placing the code in the...
4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
0
by: George Hartas | last post by:
I am using Visual C# .NET 2003 to make a ComboBox accept both mouse and keyboard selection. For mouse selection code, I double-clicked ComboBox to get the default "comboBox1_SelectedIndexChanged"...
1
by: Angus Lepper | last post by:
I'm writing a stock ticker for a stock market simulation, and can load the data into the xmlreader in the first place, but can't figure out how to refresh/update the data in it. Any ideas? Code:...
4
by: Dennis Sjogren | last post by:
Greetings! First, I'm not 100% sure where to post this question. I use VB.NET for this project, but it's really a design question (a question on which method to use when solving this problem). ...
6
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
4
by: Ron | last post by:
I am having a bit of problem with this code: Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email, telephone, description)VALUES('" & txtName.Text & "','" & txtEmail.Text & "','" &...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
10
by: sara | last post by:
Hi - Is it possible to hide the detail section of a report at run time? I have a report that prints all details, with summary lines. The user would like the report ALSO with just summary lines....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.