How To Create Dynamic Form By Clicking A Dynamic Control Placed In Dynamic Form?
Hi all,
I have generated a dynamic form at run time inside which i have placed a dynamic command button. I need to open another dynamic form and place controls in the second form on clicking that command button. Can anyone please help me to come out with the solution?
Thanks in advance, Devi
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Create Dynamic Form
How can I create dynamic form
becoz i have a table form
and i want to can change the datasource
and put some textbox switch the source
I can change the source but there's not field in the table form
can someone help me ?
thank you
Frank
Script Control, Dynamic Control Creation, And Dynamic Control Events
Hey everyone.
I have been messing around with the Scripting Control and Dynamic Control Creation.. I think it's amazingly powerful to have a program that can be extended by an end user by using VB Scripting commands. I'm actually developing a system that will allow scripts to be written, saved, and run on start-up of my program to create any additional forms or controls that end users have created so it is as if they have been there the whole time.
My problem is this:
I am creating controls as follows:
I Created a class ScriptingFunctions and added some functions to it, instantiate the class, and add the object to the ScriptControl so that i can have full control of the functions.
I run a function called AddObjectToForm(ByVal sFormName as string, byVal sObjectType as string, ByVal sObjectName as String).
It loops through vb.forms, finds the form with the name you sent, selects it, and does the following:
frmForm.Controls.Add sObjectType, sObjectName
I then call, from script, a function already in the form called "GiveAccessTo" which adds the object with the form name as a prefix to the ScriptControl.. so if I just created a "Vb.CommandButton" with name "cmdNew", I can access it through the scripting control now using "frmFormcmdNew.Caption = "NewCaption""
My problem is, however....
How can I add code .. through the scripting control, for the events on the new control I just created?
I could see creating a new windowproc in the scripting control and doing a SetWindowLong w/ GWL_WNDPROC to subclass the window procedure, but I'm not sure what I would have to do with the function? Should I have a MsScriptControlCTL.Module and add the function to that, and reference that function via AddressOf to get the pointer to that function?
Don't forget, I know when the program ends, all of this will go away, but Like I said, I plan to have the script saved so it will execute on startup.
I'd really appreciate any help anyone could give me on this.
Thanks a lot in advance! :)
--NipsMG
Can't Create Dynamic Control Array
I'm using VB6 and want to create a set of text boxes dynamically at run-time. I've looked at the "controls.add" method, and I've dug through the help references on control arrays until I'm blue in the face and I've tried everything I can think of. For FORMS, I have no trouble creating dynamic arrays at runtime, but for TextBoxs I just can't get anything to work. Suggestions?
Thanks for your time.
How To Create Dynamic Control Array?
Hi,
I know how to create a dynamic control - but How to create such dynamic array?
It will be very helpful to give me a link of guidance/example etc.
Thanks in advance!
Help Me! I Want To Create Dynamic Activex Control!!!!!
Help me! I want to create dynamic activex control!!!!!
--------------------------------------------------------------------------------
Hey, Everybody. I created a activex control (ocx) myself and I have a standard .exe project that I need create dynamic activex controls array. that part is fine and I did not know how to implement events in any activex control. ( for example: I already implement a click() event in my shapelabel ocx, but I did not know to trigger the event in my dynamic activex control) Please Help! That is part of my new project. Thanks in advance
The following is my ocx code
Option Explicit
Public Event Click()
Private NewCaption As String
Private NewBackColor As OLE_COLOR
Private NewForeColor As OLE_COLOR
Private oHeight As Integer
Private oWidth As Integer
Public Property Get Caption() As String
Caption = lblCaption.Caption
End Property
Public Property Let Caption(ByVal NewCaption As String)
lblCaption.Caption = NewCaption
PropertyChanged "Caption"
End Property
Public Property Get ShapeColor() As OLE_COLOR
ShapeColor = ShpBack.FillColor
End Property
Public Property Let ShapeColor(ByVal NewShapeColor As OLE_COLOR)
ShpBack.FillColor = NewShapeColor
PropertyChanged "ShapeColor"
End Property
Public Property Get ForeColor() As OLE_COLOR
ForeColor = lblCaption.ForeColor
End Property
Public Property Let ForeColor(ByVal NewForeColor As OLE_COLOR)
lblCaption.ForeColor = NewForeColor
PropertyChanged "ForeColor"
End Property
Private Sub UserControl_Initialize()
oHeight = UserControl.ScaleHeight
oWidth = UserControl.ScaleWidth
End Sub
Private Sub UserControl_InitProperties()
Caption = UserControl.Name
ShapeColor = vbRed
ForeColor = vbBlue
End Sub
Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Point(X, Y) = ShpBack.FillColor Then
RaiseEvent Click
End If
End Sub
Private Sub lblCaption_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_Resize()
ShpBack.Width = UserControl.ScaleWidth
ShpBack.Height = UserControl.ScaleHeight
lblCaption.Height = lblCaption.Height * (ScaleHeight / oHeight)
lblCaption.Width = lblCaption.Width * (ScaleWidth / oWidth)
If (ScaleHeight / oHeight) <= 3 Then
lblCaption.FontSize = lblCaption.FontSize * (ScaleHeight / oHeight)(ScaleHeight / oHeight)
End If
If (ScaleWidth / oWidth) <= 3 Then
lblCaption.FontSize = lblCaption.FontSize * (ScaleWidth / oWidth)(ScaleWidth / oWidth)
End If
oHeight = ScaleHeight
oWidth = ScaleWidth
ShpBack.Move 0, 0, ScaleWidth, ScaleHeight
lblCaption.Move (ShpBack.Width - lblCaption.Width) / 2, (ShpBack.Height - lblCaption.Height) / 2, lblCaption.Width, lblCaption.Height
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Caption", Caption, UserControl.Name
PropBag.WriteProperty "ShapeColor", ShapeColor, ShpBack.FillColor
PropBag.WriteProperty "ForeColor", ForeColor, lblCaption.ForeColor
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Caption = PropBag.ReadProperty("Caption", UserControl.Name)
BackColor = PropBag.ReadProperty("ShapeColor", ShpBack.FillColor)
ForeColor = PropBag.ReadProperty("ForeColor", lblCaption.ForeColor)
End Sub
'
'the following is my standard .exe project to create dynamic activex control array :
'
Dim myctl As New Collection
Private w
Private Sub Form_Load()
On Error Resume Next
For i = 1 To 5
myctl.Add Controls.Add("shplbl.shapelabel", "ctlGrp" & CStr(i))
myctl.Item(i).Width = 1500
myctl.Item(i).Height = 1000
myctl.Item(i).Top = 250
myctl.Item(i).Left = myctl.Item(i).Width * (i + 1) - 2000
myctl.Item(i).Visible = True
'myctl.itrm(i).
Next
If Err.Number <> 0 Then
If Err.Number = 731 Then
Licenses.Add "ShpLbl.ShapeLabel"
Else
GoTo errHandle
End If
myctl.Add Controls.Add("shplbl.shapelabel", "ctlTest")
End If
errHandle:
MsgBox Err.Number & vbCrLf & Err.Description, vbExclamation, "Error in Creating New Object!"
End Sub
(1) Making Vertical Scrollbar On A Vb Form (scrolling Vb Form). (2) Dynamic Text Storage.
Code:Option Explicit
Dim WithEvents ctlText As VB.TextBox
Private Sub Form_Load()
Dim i, l As Integer
For i = 1 To 4 Step 1
l = i * 700
Set ctlText = Controls.Add("VB.TextBox", "ctlText" & i, Form1)
ctlText.Move 1000, l, 1000, 500
ctlText.Visible = True
ctlText.Text = "" & l
Next
End Sub
How can i make a vertical scrollbar such that in case the textboxes are more than 4 and cannot fit on the form, the others are also visible by scrolling down the form.
How can i store data from each textbox to the database or file.
Form To Form Interaction Problem. (dynamic Forms)
Hello,
I have a form (MAIN) which is duplicated during runtime using
Dim X As Form
Set X = New MAIN
X.Show
"MAIN" contains functions, which trigger events for that form. My problem is, I have another form "TOOLS" which needs to interact with the "MAIN" from which it was launched. So far, "TOOLS" interacts only with the first "MAIN", and not with the one it was launched from. I know I could make "TOOLS" a user control and place it within "MAIN" so that it will work, but I prefer to have "TOOLS" be a single form. Any ideas on how I could solve this with ways to reference the form from which "TOOLS" was launched to where I can interact with it will be much appreciated.
Thank you ahead of time
Dynamic Vb Form
hi i am using an activex control, in which i have to create a new form when user calls a function
note:
dim newfrm as form
set newfrm=new form1
i dont want the above coding, because to use the above a form1 has to be there, i dont want any form to be attached, i want to create it dynamically,
any suggestions, appreciated,
thanks in advance
Dynamic Form
What is the easiest way to do ONE form which changes as a user clicks a button (or in my case a treeview node)? An example of what I mean is like a wizard screen that changes when you click the next button.
Currently, I just used the treeview click event to change the visibility, size, & position of the frames that I have on my one form. The visibility of each frame depended upon which node was clicked. Obviously, I don't think this is the best way to do it because I could end up with a lot of frames on my one form.
Edited by - jharter on 2/28/2003 7:40:18 AM
Dynamic Form
Hi, I need to build a form that is dynamic like what is seen on search engines pages in the internet, whereby the length of the form is dependent on the amount of data searched. How can this be possible on a desktop application?
Form As Property Of Other Form + Dynamic Menu
Hello everyone,
this is urgent, any ideas welcome.
Ok, I have a form and user can type log in there. In the log he can insert a problem description and solution from database. He searches this in a different form.
Now what do I want? I want to pass the first form (log) as a property to the searchform.
So when the user clicks "Insert" I can insert the right things in the right log (more forms can be open on the same time of the log thingy). Any ideas on this ? Thank you!
Also just a little question, how do I make my menu Dynamic, so that it changes the possible options when I activate a certain form. Without typing all the visible things.
Thank you!
Greetz
Search before you ask - if you don't know where to search, ask before you search
Dynamic Form Events
I am able to generate a form dynamically inside of a class module. My problem is how do I actually get my object to respond to the dynamic forms OBJECT events. Here is my form code.
(form code)
----------------------------------------
Dim x As TipOfDay
Set x = New TipOfDay
x.GenForm = Me
x.GenerateForm
----------------------------------------
(end form code)
Now inside the class module I have declared all objects and they actually show up when I run the program. All of the dynamic form objects have been delared Public and withevents in the general section of the class module. My objects show up in the objects list, but when I click my command button "cmdTipOK" (during run time) it does not respond to its events.
During runtime when I click on "cmdTipOK" the cmdTipOK_Click event does not fire. I am tring to implement cmdTipOK_Click inside of my class module where the command button has been declared "withevents"
My quesion is, how can I get form objects which are dynamically created, on a dynamic form, inside of a class module, to respond to thier respective events. Below is the class module code.
(class module code)
----------------------------------------
Public WithEvents TipForm As Form
Public WithEvents cmdTipOk As VB.CommandButton
Private WithEvents dummy As Form
Public Sub GenerateForm()
Set cmdTipOk = TipForm.Controls.Add("VB.CommandButton", "cmdTipOk", TipForm)
With TipForm
.Caption = "Tip Of The Day"
.Left = 2310
.Width = 5535
.Height = 3690
.Visible = True
End With
With cmdTipOk
.Caption = "OK"
.Default = True
.Height = 375
.Left = 4080
.Top = 120
.Width = 1215
.Visible = True
End With
TipForm.Refresh
End Sub
' ****** THIS EVENT NEVER FIRES ************
Private Sub TipOk_Click()
MsgBox "Im Here"
End Sub
Public Property Let GenForm(ByRef F As Form)
Set dummy = F
End Property
----------------------------------------
(end class module code)
Any help is greatly appreciated. Thanks!
Add Code To Dynamic Form
Hello,
I new to vb dynamic area.
I just created a form using the standard.
Dim frm As New Form1
frm.Show
I have added labels and a command button to the form dynamically.
but,
I am having trouble executing the new button's event.
For now, just for sake of this button, would be to
just unload this new dynamic form.
thank you
Dynamic Form Events
after adding the controls (a.e. textboxes, comboboxes, etc.) like this :
Code:
for each r in selection.rows
Set Mycmd = Frame1.Controls.Add("Forms.TextBox.1", "TextBox" & i, Visible)
Mycmd.Left = 50
Mycmd.top = 0 + (30 * i)
Mycmd.Width = 175
Mycmd.Height = 20
Next
how can i respond to events like a.e. KeyPress or Change ?
thx
Re Dynamic Form Creation
ive searched this forum and google to not much avail on this one im afraid.
i just need a few pointers on the topic of dynamic form creation. maybe someone has come across a resource that might help or maybe someone has some advice.
Dynamic Form Creation...
Ok, this dynamic form creation issue has plagued me for quite some time now. i have searched the forums, and all the forms created at runtime are based on a "template" form like Forms.Add("Form1") where Form1 is an existing form. My issue is that I am writing a 2D game engine and want it to create a backbuffer form at runtime. This will be something I want somebody to just use the classes without having to worry about adding a template form and what not. I have:
Code:
...
Dim frmBuffer As Form
Private Sub Class_Initialize()
'******************************
'* INITIALIZE THE GAME ENGINE *
'******************************
'CREATE A MEMORY RESIDENT BACKBUFFER
Set frmBuffer = Forms.Add(Form)
End Sub
That obviously won't work. Is there a way to do this, or do I need to use the window creation API's? I originally only planned on generating a device context and using that for my backbuffer, but im not sure if using CreateCompatibleDC(0) would be sufficient for a backbuffer? Im confused...LOL. Any ideas?
P.S. The code above is inside of a Class Module.
Dynamic Form Generation
dear masters,
i want to generate dynamic forms(in VB) i.e., while program is running like in java.
duing runtime the objects attach to form and destroy when not required.
thanking you
Dynamic Form Creation
hi There
First i've looked here on the forum but, it not really what i'm going to ask.
As I said in the title I've though about pure dynamic object creation.
Now I know how to create these objects dynamically for example:
Code:
Dim TempForm as form
Set TempFrom = new Form
but the only problem i'm have is about the code for these parts, what I mean is lets say again I create a dynamic form, and I'll obviously have to create dynamic controls as well:
(1) Create dynamic form
Name: TempForm
(2) Create two dynamic button controls
Names: cmdOK and cmdCancel
Caption: "OK" and "Cancel"
But its the code for the form and what ever else, lets say closing the form, as the controls are constructed dynamically how do I make the control event call the corresponding code for the controls and the forms itself.
Does this have to be in a class situation or something else, may be i'm confusing myself and thinking to hard into it.
A tutorial or post would be grat on this subject so I could understand what to do.
the pig.
Dynamic Reference To Form
Hello,
I've been working on an Access2k to VB6 conversion and keep running into hurdles over differences between VB and VBA code. The latest is this...On Form Load, I am performing a loop to return all of the controls on the form so that I can enable or disable them according to the user's access rights stored in a database. Reading the controls on the form works fine and finding the control in the table works fine, but when I run the code below to enable that control on the form, I get a "Type Mismatch" error.
Code:
Sub Control_Access(ByVal Form_Name as string, Control_Name as string)
Forms(Form_Name)(Control_Name & "_Button").Enabled = True
Can someone please help me figure out why I'm getting this error and is there another way to write this code?
Many Thanks!
Dynamic Form (chkBox)
hi there,
first of all, i am really new (1 1/2 weeks)to vb6 programmin so excuse if i lack basic knowledge. i searched the "tutors" forum and "code library" but i was unfortunate.
i want to create a frame, which has dynamical checkboxes and labels. so for example i want the frame to have 4 checkboxes it reads my variable iCount = 4 and it shall create 4 checkboxes and labels beneath the checkboxs...and for iCount = x , x checkboxes and labels ...
i tried it with the code from "Dynamically Add Controls to a Form with Visual Basic 6.0" in the msdn library but without success...
thats what i wrote untill now.
#################################################
Option Explicit
Dim WithEvents ctlText As VB.TextBox
Dim WithEvents chkBOX As VB.CheckBox
Dim WithEvents lblLtg As VB.Label
Dim WithEvents ctlCommand As VB.CommandButton
Dim i As Integer
Dim iCounter As Integer
Private Sub Form_Load()
Dim i As Integer
Set chkBOX = Controls.Add("VB.checkBox", "chkbox", Form1)
Set lblLtg = Controls.Add("VB.label", "lblLtg", Form1)
chkBOX.Move 1, 1, 2500, 3500
' Make it visible
chkBOX.Visible = True
lblLtg.Visible = True
End Sub
################################################
thx 4 ur help
Dynamic Form Creation
uhh, this is reguarding an old topic...
how exactly would I create a new "api" form and add controls to it based
on data input from a socket?
a request is sent to a server, the response comes back looking
something like the following:
FORM
Name "testform";
FavIco yes;
MaxBtn Off;
MinBtn On;
Title "this is my api form";
x12 y30 h40 w20
LABEL
caption "test label";
x120 y60 h30 w10 transparent;
@LABEL
IMAGE
img "server://12.34.5.678/img/picture.gif";
x60 y12 h40 w40 transparent;
@IMAGE
@FORM
how would something like the above be translated into an api form being
created and displayed on the screen?
I guess what I want to know, is how exactly would I write a routine to
take that bit of data and prepare it to be displayed as a form...
Any thoughts on this would be apprecaited,
- robert
Dynamic Form Sizing
Hi Everyone,
Can you code a program in VB6 to be dynamic in regards to the size of the form? For example, If a user wants the program to be maximized, he'll hit the maximize buttom and the program will go full screen. In going full screen, the txtboxes, listboxes, etc... all expand to fit the size of the screen. Same goes for all sizes inbetween. The program expands and contracts to fit the size of the form the user wants.
If this is possible, could someone tell how to do it, or direct to me information regarding this. Thank you.
Dynamic Help Datagrid Form
I'm using a small window datagrid to help user fill some fields, like Zip codes, company names, countries etc. But i noted that for each form i build i have to build a new datagrid. I've trued to add a variable to help datagrid choose where form she will send the values. For e.g user is filling a new company mail sender, to store him in database, when came the part to fill zipcode he presses a small command button and displays the datagrid ( in attachnment ) and select the proper zipcode and when presse "Enter" he sends the value form the proper object. Until here i can do easly. But i dont want to build again the same datagrid. So the ideia was to add a variable to say to datagrid witch form as called her. So when she send the value send to the correct form.
VB Code:
Private Sub cmdSelect_Click()Dim vForms As StringvForms = "frmEmpresas"frmSELECTCODPOSTAL.lblforms.Caption = "frmEmpresas"End Sub
As you may see i've set a variable called "vforms" witch in each diffrent form i only set as "frmEmpresas" or something else. When i press cmdSelect he send to datagrid the variable "vForms".
VB Code:
Public vForms As String Private Sub cmdCancelar_Click()[color=DarkOrange]frmEmpresas[/color].txtcodpostal.Text = EmptyUnload MeEnd Sub Private Sub DataGrid1_Keypress(Ascii As Integer)[color=DarkOrange]frmEmpresas[/color].txtcodpostal.Text = DataGrid1.Text[color=DarkOrange]frmEmpresas[/color].txtcodpostal3.SetFocusUnload MeEnd Sub
In datagrid the variables vForm is "frmEmpresas", and was supposed be replaced by "vForms" value.
Any one has done something like this ?
Dynamic Highscore Form
Ok, I'm stuck. I'm making a highscore form that will update whenever the user gets some points, and when it updates it will check if the current score is higher than any of the others, and if it is it will move that name down the list along with the other names and will place the new score where it should go.. of course, I check to make sure it isn't the same name so that it won't keep printing the score whenever it changes.. I can get it mostly working, but not totally..
Does anyone know what's wrong with this?
mod_Main
VB Code:
Public i As Integer, j As IntegerPublic hiscore(1, 9) As String, v_name As String, v_score As IntegerPublic game As New frm_Game, highscore As New frm_highScoreOption ExplicitPublic Sub updateHiScore() Dim tmpscore(1, 9) As String 'first populate the temp score array with the hiscore array elements For i = 0 To 9 Step 1 tmpscore(0, i) = hiscore(0, i) tmpscore(1, i) = hiscore(1, i) Next i 'check if highscores should be updated For i = 0 To 9 Step 1 If v_score > Val(hiscore(1, i)) And v_name <> hiscore(0, i) Then 'update the highscore as needed For j = i To 8 Step 1 hiscore(0, (j + 1)) = tmpscore(0, j) hiscore(1, (j + 1)) = tmpscore(1, j) Next j hiscore(0, i) = v_name hiscore(1, i) = v_score Exit For ElseIf v_name = hiscore(0, i) Then 'add to the current user score hiscore(1, i) = v_score End If Next i 'clear the highscore form highscore.Cls 'now update the highscore form highscore.Print "Name"; , , "Score" For i = 0 To 9 Step 1 highscore.Print (i + 1) & ". " & hiscore(0, i); , , hiscore(1, i) Next iEnd Sub
frm_Game
VB Code:
Option ExplicitPrivate Sub cmd_pnt_Click(Index As Integer) Dim v_index As Integer 'increase the user score depending which button is clicked 'make sure to add one to the index to make it not multiply by 0! v_index = Index + 1 'v_index * 10 makes: 1 = 10, 2 = 20, 3 = 30 v_score = v_score + (v_index * 10) 'update the highscore updateHiScoreEnd Sub
The game part of this is really simple, I'm just trying things out.. I took out things in the form that wouldn't be of any use for solving this for easy reading.. When running the current code, it will print to the highscore form, but it will keep putting down the same username.. It will move different usernames down, but it will put the same username down again and again.
Dynamic Menu In MDI Form
Does anyone know if there is an event that is fired when you change from one child form to another in a MDI Form.
I am trying to change the menus deppening on which form is selected.
Anyone got any ideas.
Paul
Dynamic Form Show
All I want to be able to do is hide or show different forms (or open new one if they arn't already open) in a VB 6.0 Application...
The wall that I am hitting is that I can't evaluate a varable as an object. ie. tempx = form2, tempx.show. Is there anyway to evaluate tempx so that I can do something like eval(tempx & ".show") like you can in cold fusion...?
If not is there any OTHER way to have a node open up a window that is gets from the nodes Tag value? (the tag value equals the form I want to show)
Thanks,
Cold As ICE.
Dynamic VB Form Creation
How to create a form dynamically from a VB application so that it can display database information on user-request. I also want to attach code dynamically to control events.
Thanx
Dynamic Form Menus
Im trying to get my app to pull menu options from an INI file.. is this possible?
its setup like this:
App::
File:
>Browser
>Site 1
INI::
[Sites]
Site1
i want it to pull the number of sites i have in the ini so i if have 10 sites there sould be ten options under the browser menu.. any help would be great i cant find any info on this at all
Dynamic Controls On Form
Can a Form have a variable number of controls, each control placed at avariable location ?
At run time ( the Load event ), I would like to use "New" to create eachcontrol and add it to the forms collection of controls.
Then, during Form events like Paint or KeyPress, iterate thru thecontrols collection, assigning the size and location of the control,determine which control received the key press character, rtv thecontents of the control.
Is this doable ? Some code that gets me started would be very helpful.
Thanks,
Steve Richter
AS400 pgmr
Dynamic Form Generation
Hi All,
I need to develop a small utility, which should take a ".frm" file as input and generate a new form based on the input form. In short, I should see the GUI of the given input form. And am not much bothered abt the functionality.
Thanks in Advance,
Thanks & Regds,
Raajesh
Using A Dynamic Grid On A Vb Form
Hi,
I am looking to build a form where there is a grid that is working like a chest game; havin columns a to f and row 1 to x. I am not taking about a data grid, but a real grid over the form, where I could move an object from place to place on the grid.
Can you help me.
Dynamic Creation Of Form
Hi gurus!
I have to create forms dynamically in my VB program.
For example,
If some event occur, have to create form.
Then I have to get the form's object variable.
Could anybody help me in detail(sample source code)?
DonYoung,Jeong
Dynamic Form Objects - How To Use
In MS Access the Open form statement takes a string as the name of the form. In VB6/SQL server I have a list in a listbox of the names of many crystal report files. When one is picked, the chosen name is placed in the ReportFileName property of the crystal control. The name is then used to check a table of reports on SQLsrvr to see if it needs parameters before running the report, and if so, I want to be able to open a 'dlgformname' to get them, where formname is the same name as was chosen from the list. However, there seems to be no way to assign a form object reference to a form object variable using just the string name of the form somehow to resolve the object expression to the form class. Am I missing something? Ideally it would be functionally like:
Dim genericform as Form
Set genericform = New 'formname' where formname is a string variable
genericform.show
Is there any way to do this using a string variable containing the name of a form?
Dynamic Form Loading
I have a list of form names in a list box. When I select one of the form names I am loading it to a textbox that verifies the form to load. I am trying to take the name it the textbox and load the form. How can this be done?
Thanks,
Dynamic Form Loading
Hi,
I am new here, so this may have been posted already. Basically, I wish to do the following:
1. create a simple project with 1 form (say
frmMain), and with one button on the form.
2. when button is pressed, then load in a form
from disk and display it, such as an About
form.
I cannot find anything on how this can be done. Pseudo code wise, this would be:
Dim obj As Form
Set obj = New Form("c:vbAbout.frm")
Load obj
obj.Show
But there is no such Form("c:vbAbout.frm") functionality.
Is there a way to accomplish this?
With thanks,
Tam
Dynamic Forms With Dynamic Controls
I have an mdi form with a couple of child forms on it. these children forms are pre loaded with controls with an index of 0. i create an instance of these children forms and load some controls at run time. in some cases (like a label control) the controls are not visible. and in another it gives run time error 340 (control array element 1 does not exist).
Hope someone can tell me what gives this kind of error?
TIA
ferdz
Dynamic PDF Document In A MSAccess Form
I'm trying to build a form that contains a PDF document using the "Adobe Acrobat Control for ActiveX" with the "PDF.PdfCtrl.5" Class. I can give it a static location (src=c:file.pdf) and it opens just fine. But what I want to do is give it the location (directory) and use an Expression for the filename ("c:"&Forms![form]![control]&".pdf").
I thought I might be able to use the "GetObject" function to load it, but that just gives me "Run-time error '429'".
Anybody got any ideas?
Dynamic Form Desing Using A Profile
Hi, all
I am developing a project..its kinda very dynamic one. Here's wht it does and how i want it to "behave".
i want the user to design or tell the number of controls and their positions (and ofcourse the attributes) on a form, thru a wizard. These details will be saved in a profile file (may be a .txt or .ini file). Then the user can use this file to setup a form, to enter the information. (It's a system to store information about the examinations....).
I have to set things like this is that , the format of the exams might change over time and i want to be prepared....for it.
So any codes to do this..or any prjects...
Any suggestions, readings or directions are welcome..and highly appreciated. Any case studies could be great too..
Thanks a lot...
voidmain
Dynamic Class Automation Behind Form
This is a second attempt on this question. The first I believe was being overlooked in the General Category.
I've created a function that creates a form dynamically, this part works how I wish it to. My problem is when I use the CreateEventProc method, the class is created with the form, but the VBE window appears. This obviously would not be acceptable during runtime. Below is my code.
Code:
Function WorklogForm() As Boolean
Dim frm As Form
Dim Frm_Min, Frm_date_lbl, Frm_Min_Lbl As Control
Dim Frm_comment, Frm_enterby, Frm_Date As Control
Dim Frm_Close As Control
Dim intDataX As Integer, intDataY As Integer
Dim cevent As Module
Dim eventInt As Long
On Error GoTo Error_WorklogForm
intDataX = 1440
intDataY = 230.4
Set frm = CreateForm(worklog, "worklog subform")
With frm
.DataEntry = True
.RecordSelectors = False
End With
Set Frm_date_lbl = CreateControl(frm.Name, acLabel, , "[Frm_Date]", "", 57.6, 57.6, 900, 240.5)
With Frm_date_lbl
.Caption = "Entered on:"
End With
Set Frm_Date = CreateControl(frm.Name, acTextBox, , "", "[enteredon]", 1008, 57.6, 3888, 240.5)
With Frm_Date
.BackColor = 12632256
.SpecialEffect = Flat
.FontWeight = 700
End With
Set Frm_comment = CreateControl(frm.Name, acTextBox, , "", "[comments]", 60, 360, 7920, 840)
Set Frm_Close = CreateControl(frm.Name, acCommandButton, , "", "", 60, 1320, 1008, 403.2)
With Frm_Close
.Caption = "Submit"
End With
Set cevent = frm.Module
eventInt = cevent.CreateEventProc("Click", Frm_Close.Name)
cevent.InsertLines eventInt + 1, vbTab & "DoCmd.Close acForm, Me.Name, acSaveNo"
Exit_WorklogForm:
Exit Function
Error_WorklogForm:
MsgBox Err & " :" & Err.Description
Resume Exit_WorklogForm
End Function
I'v been beating my head against the wall for three days on this. I know I'm close, but just not close enough..
Any help would be appreciated
Dynamic Crosstab Query In A Form
Does anyone know how to update the form as the crosstab column headings
change as the data does.Help!!
The columns headings are week number and must be dynamic.
Form Dynamic Content Problem
I have help icons next to all my input fields, when you click on them, its supposed to show another form next to the form the text boxes are on, as you click each "icon", the content of the other form is supposed to change but its giving me a problem. Can you please review and let me know where I am going wrong? Thanks in advance.
VB Code:
Private Sub picHelp_Click(index As Integer) frmHelpPullout.Left = frmRegister.Left + frmRegister.Width + frmHelpPullout.Width frmHelpPullout.Top = frmRegister.Top frmHelpPullout.Height = frmRegister.Height frmHelpPullout.Show Select Case index Case 0 'username frmHelpPullout.lblHelpCaption.Caption = "Username" frmHelpPullout.lblHelpContent.Caption = "The username field is required and is the username that you would like to register the software under." Case 1 'email address frmHelpPullout.lblHelpCaption.Caption = "Email Address" frmHelpPullout.lblHelpContent.Caption = "The email address field is required and must be an active email address because this is where your software licence number will be emailed to upon creation." Case 2 'name frmHelpPullout.lblHelpCaption.Caption = "Name" frmHelpPullout.lblHelpContent.Caption = "The name field is required and is self explanitory. Enter in your full name here." Case 3 'company frmHelpPullout.lblHelpCaption.Caption = "Company" frmHelpPullout.lblHelpContent.Caption = "The company field is not required and is self explanitory. Enter in your company name here." Case 4 'address line 1 frmHelpPullout.lblHelpCaption.Caption = "Address Line 1" frmHelpPullout.lblHelpContent.Caption = "The address line 1 field is required and you must enter in the first line of your address." Case 5 'address line 2 frmHelpPullout.lblHelpCaption.Caption = "Address Line 2" frmHelpPullout.lblHelpContent.Caption = "The address line 2 field is not required and is an additional line where you can add a second line of your address here." Case 6 'city frmHelpPullout.lblHelpCaption.Caption = "City" frmHelpPullout.lblHelpContent.Caption = "The city field is required and this is where you add your address city." Case 7 'state frmHelpPullout.lblHelpCaption.Caption = "State" frmHelpPullout.lblHelpContent.Caption = "The state field is not required unless your address contains a two letter state code." Case 8 'zip/postal code frmHelpPullout.lblHelpCaption.Caption = "Zip/Postal Code" frmHelpPullout.lblHelpContent.Caption = "The zip/postal code field is required and is self explanitory." Case 9 'country frmHelpPullout.lblHelpCaption.Caption = "Country" frmHelpPullout.lblHelpContent.Caption = "The country field is required and must contain the country in which you reside." Case 10 'phone frmHelpPullout.lblHelpCaption.Caption = "Phone Number" frmHelpPullout.lblHelpContent.Caption = "The phone number field is required and must contain your complete phone number. Numbers permitted only." Case 11 'fax frmHelpPullout.lblHelpCaption.Caption = "Fax Number" frmHelpPullout.lblHelpContent.Caption = "The fax number field is not required but if completed, must contain only numbers." End SelectEnd Sub
Added green "resolved" checkmark - Hack
Wrapping Controls In A Dynamic Form...
Ok, so i have this code (see below) its a music composer for ocarinas. (wind instrument, bout the size of a cell phone) anyway, so I load up picture boxes of the notes into the main form, the only problem is, when i create too many of them, they go off the screen, if the user resizes the form, the notes (pictureboxes) need to wrap with the form...
oh, and the notes need to stay about 450 twips (or one note) away from each other and the top
can you help me out?
Dynamic Controls On A Container In The Form
Dear Friends,
I want to create the controls on a container like a grid or some toher thing on the form as follows...
It's just example code and please tell me how can i create an array of controls like this.
Option Explicit
Dim WithEvents cmdButton As CommandButton
Private Sub Form_Load()
' Create the control
Set cmdButton = Controls.Add("VB.CommandButton", "cmdButton",me.MsFlexGrid.textmatrix(r,c))
' set the controls properties
With cmdButton
.Caption = "Created at Runtime"
.Width = Me.TextWidth(.Caption) * 1.5
.Left = 300
.Top = 200
.Visible = True
End With
End Sub
Private Sub cmdButton_Click()
MsgBox "I created this button"
End Sub
Thanking You,
Execute/ Open Dynamic Form
Dear Gurus,
How to execute/call form where the name is not fix.
The desription is like this
My menus is change during runtime, so i can't fix the code to call the form. Is it any other way to create sub whereby we can just pass this formname and this sub will create something like
dim formname as new form
formname.show()
if the formname is fix is not a problem, the hard things is the formname is dynamic.
pls help
regards
wisman
Dynamic Text Box Height In A Form.
I'm working with Access 2000 and have a form that is required to look similar to a word document. My only setback is getting the text boxes to display all the information dynamically.
In other words, I don't want to use the vertical scroll bar, but rather want the text box fit the size of the text.
I have "can grow" and shrink set to TRUE which works great for the reports and printing. However, I need to be able to have the same occur in the form itself. Any ideas???
Thanks,
Lord Raiden
Edited by - LordRaiden on 11/20/2003 9:49:02 AM
Dynamic Search Results Form Creation
Hi all-
I've been using VB (VB 6.0) for about 4 days now, just quickly putting together a small application.
Now a requirement I have is to display search results (from the database) as a series of text labels under the following column headings:
Item, Type, Number in Stock, Price.
Now while i'm able to generate these results in, say, a ListBox, i need to do it in rows of text labels (or plain text anyway) for each search result. In addition I need a textbox against each result for a user-enterable quantity value. (so the function is to search, get results, then enter required quantity against any/all results).
My problem is that i've mainly been using drag/drop form functionality in VisualStudio - which provides just fine for static forms, but i am going to need to display a row of labels + text box for 'n' results which i won't know until i conduct a search.
Hopefully i've explained this problem well enough - let me know if I haven't. Is there an appropriate existing control to do this, and if not, can someone help me out with code to add these search results to a form dynamically?
Thanks
Creating A Class Object Behind A Dynamic Form
I've created a function that creates a form dynamically, this part works how I wish it to. My problem is when I use the CreateEventProc method, the class is created with the form, but the VBE window appears. This obviously would not be acceptable during runtime. Below is my code.
Function WorklogForm() As Boolean
Dim frm As Form
Dim Frm_Min, Frm_date_lbl, Frm_Min_Lbl As Control
Dim Frm_comment, Frm_enterby, Frm_Date As Control
Dim Frm_Close As Control
Dim intDataX As Integer, intDataY As Integer
Dim cevent As Module
Dim eventInt As Long
On Error GoTo Error_WorklogForm
intDataX = 1440
intDataY = 230.4
Set frm = CreateForm(worklog, "worklog subform")
With frm
.DataEntry = True
.RecordSelectors = False
End With
Set Frm_date_lbl = CreateControl(frm.Name, acLabel, , "[Frm_Date]", "", 57.6, 57.6, 900, 240.5)
With Frm_date_lbl
.Caption = "Entered on:"
End With
Set Frm_Date = CreateControl(frm.Name, acTextBox, , "", "[enteredon]", 1008, 57.6, 3888, 240.5)
With Frm_Date
.BackColor = 12632256
.SpecialEffect = Flat
.FontWeight = 700
End With
Set Frm_comment = CreateControl(frm.Name, acTextBox, , "", "[comments]", 60, 360, 7920, 840)
Set Frm_Close = CreateControl(frm.Name, acCommandButton, , "", "", 60, 1320, 1008, 403.2)
With Frm_Close
.Caption = "Submit"
End With
Set cevent = frm.Module
eventInt = cevent.CreateEventProc("Click", Frm_Close.Name)
cevent.InsertLines eventInt + 1, vbTab & "DoCmd.Close acForm, Me.Name, acSaveNo"
Exit_WorklogForm:
Exit Function
Error_WorklogForm:
MsgBox Err & " :" & Err.Description
Resume Exit_WorklogForm
End Function
I'v been beating my head against the wall for three days on this. I know I'm close, but just not close enough..
Any help would be appreciated
|