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




Load A New Form


Hi,
What I am trying to do is to load a new form window from a MDI window. Once this new form window is loaded and it will remain active until it is unloaded.
Can anyone please advise. ( I did this long time ago and forgot now...) Thanks!

Rgds-Jack




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Load Event - Cancel Form Load
Whilst in the form load - is there an easy way to cancel the form load? If i try to unload it I get an exception.

Captions/Text Fails To Load In Form Load
The form is set up in 2 columns
When the form loads, the left column loads the text, but the right column never loads. I have a cmdbutton that basically reloads the text values, but not the captions, on the rightside, but I need it to load it when the form loads...
Here is the form load code: (all label and txtbox names are correct)

Private Sub Form_Load()
MediaPlayer1.FileName = ("C:WINDOWSDesktopCalculator Version 2.0attle.mid")
'Fighter 1 stats
lblhp1.Caption = frmFighter1.txthp1.Text
lblmp1.Caption = frmFighter1.txtmp1.Text
lblfighter1.Caption = StrConv(frmFighter1.txtfighter1.Text, 3)
lblscreen1.Caption = StrConv(frmFighter1.txtscreenname.Text, 3)
If lblfighter1.Caption = "" Then
lblfighter1.Caption = "Fighter 1"
If lblhp1.Caption = "" Then
lblhp1.Caption = "0"
If lblmp1.Caption = "" Then
lblmp1.Caption = "0"
If frmFighter1.optnone.Value = True Then
lblelement1.Caption = "No Element"
lblelement1.ForeColor = &HE0E0E0 ' Grey
End If
End If
End If
End If
'Fighter 2 stats
lblhp2.Caption = frmFighter2.txthp2.Text
lblmp2.Caption = frmFighter2.txtmp2.Text
lblfighter2.Caption = StrConv(frmFighter2.txtfighter2.Text, vbProperCase)
lblscreen2.Caption = StrConv(frmFighter2.txtscreenname.Text, vbProperCase)
If lblfighter2.Caption = "" Then
lblfighter2.Caption = "Fighter 2"
If lblhp2.Caption = "" Then
lblhp2.Caption = "0"
If lblmp2.Caption = "" Then
lblmp2.Caption = "0"
If frmFighter2.optnone.Value = True Then
lblelement2.Caption = "No Element"
lblelement2.ForeColor = &HE0E0E0 'Grey
End If
End If
End If
End If
End Sub


Here is the whole project :

Load A List On Form Load (RESOLVED)
Ok i need to load a txt file into a list called List9 on my form. The text file is going to be called Root.txt and will be in the same folder as the program. Which will be different for peoples computers i think the path is something like App.Path & "Generated.txt" but im not sure any help ?

Song Load On Form Load Help
Ok i got this code from another source and i got it to load on form load and forum unload but my question is how do i call it from the app.path as i know not everyone has the same file directories?



Code:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

Private Sub Form_Load()
MsgBox "Korn - Yall Want A Single"
'-----How do i call this from the app.path?
soundfile$ = "C:Documents and Settingskarl rinehartDesktopProgsA sample Progsong.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub

Private Sub Form_Unload(Cancel As Integer)
StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%)
End Sub



or can anyone do this with a smaller amount of code?

RESOLVED - How To Load A Form (slightly More Complex Than "load Formname")
Hi guys,

OK, here's the situation. I have a table in a database called UserRoles containing a Role and a Startup form.

When a user runs my application a form will load asking them to select a Role. The role they select will determine which form is loaded next.

Therefore, the following events occur.
1. The user selects a Role
2. I go away to my database and retrieve the Startup form associated with this role
3. I Load the form

However, the Load command requires an Object (form, control, etc). So how could I load the form when all I have from the database is the form name as a string?

Cheers in advance

Rob

Form Initialize Vs. Form Load Vs Form Activate
I'm sure this is one of the most basic of questions in terms of VB, but I've been working with VB for 4 months now, and have yet to realize the differences between form initialize and form load and form activate.

Can some please clairify, thanks.

Generate A Unique Value To Form In VB At FORM LOAD. The Database Is SQL SERVER 2000. This
Hi,
The main purpose is that i need to generate a unique value to form in VB at FORM LOAD. The Database is SQL SERVER 2000. This application is a multiuser.

For this , I have a stored procedure which gets the maximum value and then add 1 to it and the same value is retrived into VB Form at ONLoad Event. I have noticed that i am not getting unique values into the form. i get this very rare once for every 5000 records (approx)
The stored procedure is

ALTER procedure taskno_sp
@max_tkpaid3 int=0
as
select @max_tkpaid3=max(tkpano)+1 from tkpaid
insert into tkpaid (tkpaid) values(@max_tkpaid3)

return @max_tkpaid3


Please help me in this issue and is there any way we could lock a stored procedure, so only once user can access it at a time.

Prompt A Mgsbox When Load Another Form Or Close This Form
I want to have a msgbox that prompt the user whether they want to save or not, when the user goes to another form or closing the form.
Does anyone have suggestions? And what is the method to do this?
Thanks!!

Making My Form Go To The Size Of The Picture Box When I Load The Form
I need help with making my frame automaticly load with the same size as the picture loaded in it... I have it when I browse for the picture to open it sets that picture to a frame... and the frame opens with the picture in it... but I need the fram to go to the correct size.. the same size as the picture.

Save Several Textboxs In 1 Form And Load Into Labels In Other Form. Need Help
Yo all wasup

i need help.. i'm makin a prog kinda like a games board/desktop.
the user can add a game: he puts game's name, icon, and exe path in one form (Ex: AddGame.frm).
When he opens the prog again i want it to load the games data like he typed in to a diffrent form.
So..i need a code to save the info into file(s) (One file is better ) and to save the icon or icon path.
and a way/code to load all the data back.
plz help. tnx folks

Problem: Form.Hide Calling Form.Load
Hi
I have my application wth two forms
In form1 after presssing OK I have
Form2.show
in form_load of form2 I have
form1.hide

But when it reaches on form1.hide it goes to the form_load of Form1
Any idea why?

Showing A Form W/i Another Form Load Event
In my form load event (in the default form for the app) there is a possibility that two other forms could be shown (if its an eval version or if no configurations have been defined). The problem I have with this is that neither of these forms show up in the taskbar (hence it's difficult for the user to get back to them if they need to switch to their email to get their license codes). Both have ShowInTaskbar as true (as does the default form that is loading), however I'm guessing that since the main form isn't completely loaded yet that they will not show up in the taskbar. What are my options here? I'm thinking of moving them to the Activate event, but I'm not sure if that will even trigger since the form is minimized immediately and not shown on the screen. Also, would the Activate event trigger everytime someone used the systray popup menu associated with this form? Would it be hoaky to use a boolean variable to check if the sequence of code had already been executed so it only gets launched the first time the form is activated?

TIA

Frances

Difference Between Form Load And Form Activate?
Hi guys,
Anybody knows whats the difference between form load and form activate..


Regards,
1g0r

Resizing Form On Load To Match Another Form
I am making a notepad type of program here.

Now, I have a form that I am loading on top of another one. (you could also open a 2nd text form using file -> new, calls the same procedure )

so now my problem is that I have the menu set up and I need the form to resize correctly up top and align correctly on the left, here's the code that I am working with:


Code:
' within Form_Load() sub
' move form, size
Move 25, 25, _
frmMain.ScaleWidth, frmMain.ScaleHeight

I have tried many things for the "top" and "left" parameters. Such as ScaleX, ScaleY, CurrentX and CurrentY of the main form, all of which return the value '0' it seems to me. It should not be as far as I can gather.

I would need to do something like this:

Code:
Move frmMain.Left + 25, frmMain.Top - 25, _
frmMain.ScaleWidth, frmMain.ScaleHeight

however, no matter what I do it doesn't seem to line up how I want. I obviously need to figure out where the frmMain is located before I can set the + integer and - integer in the left and top parameters.

what is it that I need to be using here?


I have one more question as well. Whenever the user goes to File -> New, it opens a new frmText.
in the general form variables I set newForm As frmText

then within the New_Click() sub I have
Set newFrom = New frmText

This works great, but then I have this as a closing argument.


Code:
Unload newForm

now this works IF and only IF your trying to close the last frmText the user opened. So I am thinking of having each form give out an integer value based on how many forms have already been made and then store that variable to the form itself, then everytime the form get's focus a class module variable changes to the value set by that frmText, then using Unload newForm(integer) or something like that.

Is that a dumb way to tackle this problem or is there some much better way that I am unaware off?

Hoe To Go To Antoher Form And Load That Form (not.show)
Hello!

I have progress bar in one form.
When pb is done I would like to open another form.
But i would like that this form would normally load (becouse I wan't to run routine under form load event).
Here is my code that is wrong:

Code:
If pb1.Value = pb1.Max Then
frmTime.Show
frmTime.Refresh
Unload Me
End If

Unload A Form In Form Load Event
i want to unloas a form in form load event

I open some database in form load event,but if database is not their or any error accures then i have to unload the form
without proceding ahead

how i can do that


please help

Form Load Not Creating All Of The Controls On The Form
I have form that contains a ssTab with 2 tabs and a set of control arrays, where each tab contains the same controls.

When I launch the program in the IDE, the first time I launch the form all of the controls appear. I go back and forth between the tabs and then I exit. When I re-open the form, all except one of my listviews appear. So that when you try to do normal processing it blows up because it is referencing a control that does not exist.

It gets better, I create an exe, and run it and it does NOT have the same bug. I had not noticed the bug all the way through the development life-cycle and now it has popped up in production.

I am wondering if this is a VB bug or something in my app. I downloaded and applied service pack 6 to my pc hoping that would resolve this with no success.

Any help would be greatly appreciated.
Thanks !!

How To Close All Active Form Before Load New Form
i have 10 form which mdi child properties is true.
how to close all active form before open a new form?

If The Form You Want To Load At Runtime Isn't The First Form Created
I've gone through the newsgroups and I don't think I found the answer to my
question.

My question does anyone know the coding to show a form at runtime if it's
not the first form created, since by default VB runs the first form that's
created. I've looked in my VB book from school to see if the coding is in,
but I think my instructor told us the code.

It's been over 2 years since I've done any VB programming and like the dummy
I am, i don't have any of my old programs *laughing*. So any assistance will
be appreciated.

How To Load Another Form Automaticall From Loaded Form????
hi all,
actually i have a problem that form A is load manually and after 30 minutes of its loading application should automatically load the second form and unload the current form. i am very new in vb6 so please reply me in detail if its possible.
thanks in advance

Load Form By Retriving Name Of The Form From Table
Hi all,
i have login table with column formname. based on username i want to load form which is defined in the FormName column.
Ex: user ID: sreddy FormName: frmDistrict Privilege: Level1

i tried the following, but it's not working:

Dim formName As Form

If (txtPassword = !Password) Then
               strUserName = txtUserName.Text
               strPassword = txtPassword.Text
               formName = Trim(!formName)
    
    Unload Me
                Load formName
    Show
                 
    'formName.Show
i have an MDI form also.
I want to load frmDistrict for some Users and MDIform for some Users. I defined menus in frmdistrict so that it acts as MDI.
Hope some body can help me
>>>>>>>>>>>>>>>>>>>>>>>



Edited by - sreddy on 4/15/2005 9:18:51 AM

Form Activate Vs Form Form Load?
Hi all,
sorry to trouble u again with my problem. well as the subject header this thread stated. i would like to know what is the different between Form_Activate and Form_Load in VB .. or in fact i am using eVB now. well, i guess it shouldnt make much of a different for this problem. appreciate your kind comment and help.

longwar

Positioning A Form On Form Load.
Hello and thanks for reading this post!

Here is what i am hoping to accomplish.

When i load my form i have buttons on that form that load other forms. My question is how could i tell the form to load the other form in the same location despite where the form is loaded on screen.

In other words, if i opened form 1 and form 2 is supposed to load by a certain button....i can get that far, but if i move form 1 again during the same session, and click the button that loads form 2, it loads in the original position that it opened the first time. How can i get form 2 to load in the same position in respect to form1 current position..
Hope that makes sense.


Another quick one if anyone has any suggestions, i have setup a form to be draggable without a border..using a label...how can i tell the program to show the hand when over a draggable area (the label).

Thanks again for reading this and for any suggestions or comments!

How Do You Load And Show A Form, From Another Form?
I apologize if I have place this question in the wrong location, I could not find an area for questions dealing with Visual Studio 2005 Express Edition. Hopefully you have a section for this question, and can move it to the correct area for me.

In VB6 to load a form and show it I would use then following


Code:
Private Sub cmdButton_Click()
Load Form1
Form1.Show
End Sub
However, this does not seem to work in VB 2005 EE.

Could someone show me how to load the form, and then show it, from both a command button and from the menustrip

Thank you in advance,

IF

Form.Load And Form.Show
Howdy,
I am switching between three forms using the Hide and FormX.Show commands. I need to check something every time a certain form is shown. I tried to put this code into the Form_Load event, but this only happens the first time it is loaded. How can I make this happen everytime the form is shown? Or where do I need to put this code?? Thanks.

Form Initialize Vs Form Load ?
So whats the difference between these 2?

Load A Form Inside A Form?
hello..

here's my question...

i have a form, with a big space in the middle of it... .in that space, i'd like to load another form... kinda like how you would do this in html with frames....

this way, the one complicated form that i have can house all the other forms when they are called....

appreciate the help!

Form Load, Form Progress
Thanks for everybody's help with my last question!

I am using threads to load a database and to have a Splash form with a progress bar and a timer.

When the main form starts to load, the Splash form freezes and will not display the progress bar running.

Does anyone know how to get both forms to run simultaneously?

Unload A Form And Load Another Form
Hi my sub is this
i would like to unload
the Main form
and load Envoi_Email
do to include anything
and by the way
i do we include the mapi control
from Vb 6
Private Sub Email_Click()
Unload Main
Load Envoi_Email
End Sub
thanks you

Load Another Refreshed Form From One Form
Hi, I am working on two forms.
Form1 is the start form of my application. User can use this form to insert information.
I also has another form2.

In form1
dim formtest2 as new form2()

When user hit a button1 on form1, formtest2 will be shown. and when user hit a button on formtest2. a refreshed form1 should be shown.

hide and show doesn't work. since it only give me the former form1.
when i tried to use dispose in form1, it will close all the application. since form1 is the start page of my application.

Thanks a lot for your help

Load A Form Into Another?
I wanted to load one form INTO another rather than beside and hide the previous form.

The one way I figured out how to do this was just by having an MDIform for my start and then load each from.

Let's say I'm writing a book and each page has a next. When next is clicked the previous form unloads and then the next page is shown. I'm not sure if this is the best way to do it but it works basically exactly like how I want it to except for on problem.

When I have and MDIform as my starting form there is no way for me to disable things like minimize maximize and close buttons because I guess MDI forms don't have them listed in properties? Or it's possible I'm blind.

So basically I would like to know how I could get rid of these and be able to customize my MDI form much like it was a regular form. While still able to make it work much like a story book would.

Form Load ?
Is there an equivalent of "Form Load" for an excel worksheet?
Also an event for column-width changes would be handy.

Thanks for any help

Form Load Help
private Sub Command3()
load frmNoc
frmNoc.CommandButton4 = True
frmNoc.CommandButton5 = True
frmNoc.Show
End Sub
i'm trying to load a form when user initiates command3. but its throwing me an exception at load as " wrong number of arguments or invalid property" this code was working earlier .. i dont know what's going on ...

need ur inputs on this... thanks.

Form Does Not Load !
In VB6 I use Form1.Load vbModal to load my forms.
I have developed an application that works on all Windows platforms that I have installed on my system as well.
But I received 2 reports from my users that for a strange reason a form does not load!
One of them is chinese and is using the chinese version of XP, and one of them is from GB, these 2 people are having problems.
One of them cannot open one of my application forms!
The other one cannot open another form inside the application!
I see that there is no any problem, let me repeat, any problem with my code, but why this occurs for them?
The guy from GB had no problem at first, but now after a while has this problem!
And the guy from China had no problem at first, but after installing the Windows Chinese Language "A 3rd Party App." encountered this problem.
Now, did anyone here faced this problem or know ANYTHING about it?
I will be happy to hear from you, if you know...

Load A Form From A DLL In VBA
After googling this one to death I have to ask something simple

I made a VB6 DLL with a form. I am puzzled on how to call the DLL in VBA and get the DLL to show its form

In the DLL I have this

Public Function showForm(show As Boolean)
form1.show vbModal
End Function

In the immediate window in VB6 I can do
form1.Show
form1.Hide
and everything is good

in VBA I try

Public test1 As New test.testDll

In the object browser I can see all of the dll's properties

Public Function showForm(show As Boolean)
select case show
case true
form1.show vbModal
end select
End Function

...VBA
test.showForm True

I get call does not support automation or expected interface error

This is got to be so easy and I can't see the forest anymore.........

Dave

Use Key To Load Form
how can I open a form when ctrl+e is clicked?


Code:
pw.show
(that's all I want to dp when ctrl+e is clicked)


//golles

Re Load Form?
I'm missing something simple again I'm sure. I'm working on a program which will eventually interact with a database. It keeps track of expenses, inventory etc for a business. Right now, I'm just trying to get it to add up the numbers it gets and give me a total. I've got several forms, one for each product basically, and a frmTotal on which I get the totals from the other forms, add them all together, mark up the costs etc. My problem is that if I'm on frmTotal, and want to go back to frmMain, for instance, and enter some more costs, when I come back to frmTotal, it does not update the information I just entered into frmMain. I realize that the problem is that I've put the code to add everything up in the Form_Load procedure. Is there a way to get the form to re load, or at least to re run the code in the Form_Load procedure? I've tried putting it on the Form_GotFocus Event, I've even tried putting an invisible button on the form, putting the code in the Click Event for the button and calling the Button_Click Event in the GotFocus Event for the form . Any help?

Load Form
hi, i trying to load a form after unloading a splash screen for 3 seconds.. this is my code..

Private Sub Form_Load()

Timer1.Interval = 1000
Timer1.Enabled = True

End Sub

Private Sub timer1_timer()

Static icount As Integer
icount = icount + 1
If icount = 3 Then
Timer1.Enabled = False
Unload Me
Load Form2
End If

End Sub

im trying to load form2.. but after for 3 seconds.. the splash screen just close without showing the form..

thanks for any help

Load FOrm
when i use

Load MyForm

why the metod MyForm_Load doen't start?

how can i load a form and tell it to run the MyFOrm_load method?

thanks

Load One Form From Another
I am beginner in programing in visual basic .I have just start programing my first aplication when i encounter problem.

I am having problem with loading form "stoperica" from form "form1"
When i try to load form
it say run-time error 361 ,can load or unload this object .
But when i try to load
i done it like this

Private Sub Stoperica_Click()
Unload Me
Load Stoperica
Stoperica.Visible = True

End Sub

But when i try to load "form1" from form "stoperica" than its ok
What is problem ?

Form Load
What happens if I load a form and then Show it upon the click of the Next button and the form had previously been loaded in memory but was hidden. Will a new instance of the form be created or will the hidden one be displayed.

Thanks

Form Load
Why is it that form_load() only works the VERY first time you load that form. If i close and then re-open it doesn't run through that function again. i need something that will execute EVERY time i open the form. Any ideas?

Load New Form
How can I load a new form with the Load New frmX function and then be able to edit it? For instance I am loading a form for a word processor but yet I need unlimited forms but also I need to change its properties. Here is part of my code...

Private Sub New_Click()
Load New frmWindow
frmWindowCount = 1
frmWindowCount = frmWindowCount + 1
frmWindow.Caption = "Doc" & frmWindowCount
End Sub

This creates a new form from frmWindow and changes the original caption, not the new form I want to change.

Thanks for any help.

Form Load
simple question...how can I tell if a form has been loaded? I need to refresh an Ado Control on a form but only if the form has been loaded...

After Form Load?
I have a sub that I want to run after the form is loaded. I put it in the form_load event but it doesn't work there. I don't want the user to have to push anything or do anything, I want it to appear as if it happened with the load. Is this possible?

Thanks,
Eva

Form Load
hi everybody. that maybe is simple but i have no clue.
i want to set a control in a form focus but i can't use the .setfocus in the Form_Load sub because it returns an error. obviously because the control isn't loaded yet.
till now i use a timer like this:


Code:
Private Sub Form_Load()
tmrFocus.Interval=50
End Sub

Private Sub tmrFocus_Timer
txt1.SetFocus
tmrFocus.Interval=0
End Sub
to put txt1.TabIndex=0 isn't big help. the control could change from time to time. any ideas?

Form Load
Is thier a way to choose which form will load first when the program loads?
-Thanks

Form Load Tip
how can i add a tooltip or tip when a form is loaded i don't want to use a msgbox.

Help With Form Load
I am using this code to choose a wav file:



Code:

Private Sub Command1_Click()

CommonDialog1.InitDir = App.Path
CommonDialog1.Filter = "Wav files |*.wav"
CommonDialog1.DialogTitle = "Choose a Wav file to open"

CommonDialog1.ShowOpen
wavsound = CommonDialog1.FileName
Dim FF As Long
FF = FreeFile
Open App.Path & "" & "test.txt" For Output As #FF
Print #FF, CommonDialog1.FileName
Close #FF
If wavsound = "" Then wavsound = App.Path & "ding.wav"
'SaveSetting App.Title, "Options", "soundfile", CStr(CommonDialog1.FileName)


Label1.Caption = CommonDialog1.FileName
End Sub
and this code to load it when the program starts



Code:
Private Sub form_load()
Dim FF As Long
FF = FreeFile
Open App.Path & "" & "test.txt" For Input As #FF
Print #FF, CommonDialog1.FileName

Close #FF
end sub
it saves the correct file path in the text file. But when you run the program it gives an error when it trys to open the text.txt file to the saved file path ?? Any suggestions on what I am doing wrong. Basically a users chooses the path where the wav file is located and when they open the program again it should open the saved file.

Thanks

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