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




Substitution Parameter For Creating Multiple Objects


I'm using the header fields from a csv file and a collection of User attributes from Active Directory to create a mapping form displaying the array of csv fields in one column and list boxes of the collection in the adjacent comlumn.

I want to programatically generate list boxes, each one with a suffix value that corresponds to the array index number for the csv column. So what I need to figure out is if there's a substitution parameter available in VB 6.0 that will read the counter variable in a For loop as a literal value.

Here's the concept in rather abbreviated logic
csvlist = ubound(csvfields)
For a in csvlist
Dim Listbox_"a" as Listbox 'Give index suffix so you create the temp objects
'Listbox_1,Listbox_2...
For Each ADattr in Usrattr.collection 'repeat
Listbox_"a".additem ADattr.name
Next
Next

The intention is to provide flexibility to the form, as there could be varying numbers of header fields (20 to 30), so that the corresponding column pairs:
csv_header = listbox_value can then be written to a configuration file.

Thought this would be the easiest way to map a group of fix values to anothe r (the AD User collection) that has dozens of possible selections.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
For...Each With A Dictionary Of Objects; Send Objects By Parameter
Hi

I have two problems

First
I have a dictionary of objects (Sentence). I want to do a For...each, to modify all the objects in my dictionary but I want to use them by ref

dSentences: Dictionary
Sentence: Object
Display: Sub of Sentence
********************
Dim sKey As Variant

For Each sKey In dSentences
Debug.Print (sKey)
dSentences.Item(sKey).Display 'To use them directly in the dictionary
Next
********************
Results:

"key1"
"Value3"

"key2"
"Value3"

"Key3"
"Value3"

Gives only the value of the last Object of the Dictionary. I don't understand because the sKey always change
Maybe my syntax is bad, but it executes Display.

The second one: how to send objects to other subs by ref? I tried the traditional way but it don't seems to work

Thanks for your help

Passing Multiple Parameters To A Multiple Value Parameter Field In Crystal
Hello,

I am using CR Developer 8.5 and Access 2000.

I have a multiple value parameter in an agent report that is a string. This parameter is used for capturing agent IDs. Parameter values are entered through an Access 2000 form. I need to allow users to enter multiple agent IDs into a text box on the form and then pass those values to the multiple value parameter in the report.

For example, the user would enter the following into the text box:

MA0083, MF0265, MH5698, etc

The report would then return information related to those 3 agents.

I am using .ParameterFields(0) in code to populate the parameter in the report using the following code:

rpt.ParameterFields(0) = "Agent;" & P18Agent & ";TRUE"

This works fine for sending only 1 agent ID to the report but how can I send multiple values from the text box P18Agent to the multiple value parameter in the report?

Thanks for your help.

Creating Business Objects Reports In Visual Objects
hi all
i want add business objects Universe in visual basic.
(universe is a query on source data base).
i want to access data from universe and i want to create report in vb. can u help me out.
regards and thanks.
james

Creating Cmd.parameter Object
I'm getting "type mismatch" for the line "Set prm =......."
Not sure why the error if I'm passing txtCompanyName.Text value to @company variable that is defined as char(50). Thx, Ik.
=============================================
.
.
Set cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "AddCustomer"

Set prm = cmd.CreateParameter("company", adChar, adParamInput, txtCompanyName.Text)
cmd.Parameters.Append prm
.
.
Stored procedure being executed
-----------------------------------------------------------------
alter proc dbo.AddCustomer
@company char(50),
@first char(50),
@last char(50)
as
INSERT INTO tblCustomer (companyname, firstname, lastname) values (@company, @first, @last)
GO

Create A Multiple Parameter Query
Hi again. This thread is following the earlier KanBan question. I would like to create a way for users to select records via typing a list into a box. After typing in values that they wanted, the values would be passed on to a report to be printed.

What would be the best way to do this? I know of several problems; those being passing multiple parameters and filtering them to the report. Ideas?

I have already seen some examples of this using a multiple selection list box, but would like to be able to enter these values manually.

Pass The Same Parameter To Multiple CMD Files?
Evening all.....

I'm going to write this out in point form, as it's easier for me to think through.

1) I have a form that will allow the users to put in their Drive letter, click a button, and then multiple install packages will run, putting the files into the Drive they specified.
2) The install packages are in the same folder, but each has their own subfolder. This is because not everyone wants to install all the packages, so I have to separate them in order to have individual buttons.
3) I am putting my VB program, and everything else, onto DVDs, so I need to have the relative paths used.
4) I need to have the install packages run one at a time; otherwise, they conflict and cause corrupt data files.

So far, what I have includes:

1) This code,


Code:
Private Sub Command1_Click()
MsgBox FreeSpace(Text1.Text)
End Sub
Function FreeSpace(drvPath As String) As String

On Error GoTo bad
Dim fso, drv

FreeSpace = "Drive Not Available."

Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.GetDrive(fso.GetDriveName(drvPath & ":"))

If drv.DriveType = 2 Then ' "Fixed"
FreeSpace = FormatNumber((drv.FreeSpace / 1024 / 1024 / 1024), 1) & " Gigabytes Free"
End If

bad:
Set fso = Nothing
Set drv = Nothing

End Function


which I got from one of my other posts. This tells the user how much free space they have based on the Drive letter they put into Text1. I am sure I can modify this code, I just can't see how. I also need to pass this drive on as the parameter to all installation files - I can't have the user going back to hit the button everytime.

2) I was going to put a copy of all the install packages into a single folder, and then have a batch run through them all; however, the smallest set of install files are 2.6 Gb, so having them copied in the same DVD just won't work (we're using 4.7 Gb DVDs).

3) From elsewhere in my program, i have


Code:
Dim sTemp As String

sTemp = CurDir
ChDir (App.Path & "subsetsEast2")
DoubleVar = Shell("install_subse contractor.cmd", vbNormalFocus)
ChDir (sTemp)

which sets the directory as the subfolder, runs the CMD file (which is called the same thing in all subdirectories), and then resets the Directory to the root. I know I should be able to use this in a loop, but everytime I've tried, all the windows open simultaneously and they don't actually install anything.

4) As mentioned above, the command prompts all open up and try running, and actually accomplish nothing. I think if i somehow managed to get my program to recognise when Command Shell - "install_subse contractor.cmd" is open, and not do anything while that window is open, I'll be OK, but everything I've tried isn't working. Also, is the Command Shell called the same thing in all instances of Windows (2000, NT, XP, and Vista?) If not, then this won't work either. (The install_subse contractor.cmd file is the one that prompts the user for the Drive they want to do the installs on. I tried by passing this, and going right to the install package - it does run, but every action the installation does goes by on the Command Prompt screen, which I don't want, and the files all get installed on the drive the file's being run from, which in the case of a DVD, won't work either (I was testing on my local harddrive)).

Well, if you're still awake after reading all that, and you have any suggestions, I'd really appreciate your input.....
Thanks all!
Chris

Multiple Parameter On Stored Procedure
Hi there,

I've used this code to execute a stored procedure how would I use it if i've got multiple parameters in my sp. I also cant get it to work with only one parameter but it works fine with no parameters. Please help.

Werner.
-------------------------------------------------------------------
Private Sub DoADO()
Dim oDBConn As New ADODB.Connection
Dim oDBComm As New ADODB.Command
Dim oParam1 As New ADODB.Parameter
Dim orS As New ADODB.Recordset
With oDBConn
.ConnectionString = "Provider=SQLOLEDB;Data Source=serverName;Initial Catalog=databaseName; User ID=userName;Password=userPassword;"
.CursorLocation = adUseServer
.Mode = adModeReadWrite
.Open
End With

With oDBComm
.ActiveConnection = oDBConn
.CommandText = "SPROC"
.CommandType = adCmdStoredProc
Set oParam1 = .CreateParameter("PARAMNAME", adVarChar, adParamInput, 50, "HELLOWORLD")
.Parameters.Append oParam1
End With
'Do some reading on the line below it'll help you
orS.Open oDBComm, , adOpenKeyset, adLockOptimistic
End Sub

Help Creating Objects In COM Objects
Object Variable or With Block variable not set.
This is the error message I always recieve from my web page when I attempt to execute my own COM Object. I'm attempting to create a cDIBSection object to load a JPG (IJL1.5) but I always get that error. How can I get around this?? Thanks!
-Aaron

Passing A Multiple Value Parameter To Crystal Reports 8
I have designed an invoice as a CR8 Report. It works fine on its own and when I call it in my VB6 app via CrystalReport control.

In my app, I have a grid to list invoices so users can select various invoices and then click on the cmdPrint. I enhanced my report by setting InvoiceNo as a GroupField so that I could pass it multiple InvoiceNos and it runs fine within CR but only accepts single value parameter from VB6.

I tried passing it a comma-delimited string but it wouldn't work, it won't accept an Integer array either.
I've searched this site, Google, and the web but I can't find a VB6-specific example.

Code:Private Sub cmdPrint_Click()
    On Error GoTo ErrHandler
    
    Dim TaxInvNos As String
    Dim x As Integer
    
    If MSFlex2.TextMatrix(1, 1) <> "" Then
        If MsgBox("Do you want to Print the Invoice?(Yes/No)", vbYesNo, gstrMessage) = vbNo Then Exit Sub
        
        For x = 1 To MSFlex2.Rows - 1
            If MSFlex2.TextMatrix(x, 13) = "x" Then TaxInvNos = TaxInvNos + MSFlex2.TextMatrix(x, 0) & ","
        Next x
        If TaxInvNos <> "" Then
            TaxInvNos = "(" & mID(TaxInvNos, 1, Len(TaxInvNos) - 1) & ")"
            Call procreport(TaxInvNos)
        End If
    End If

    Exit Sub
ErrHandler:
    MsgBox Err.number & ":" & Err.Description
End Sub

Private Sub procreport(taxinvno As String)
    On Error GoTo ErrHandler

    'The commented out lines are the other option I tried for the Long array.
    'Dim inv() As Long
    'inv = Split(taxinvno, ",")
    
    CrystalReport1.Connect = cnn
    CrystalReport1.ReportFileName = App.Path & "
eportsInvoice2.rpt"
    CrystalReport1.ParameterFields(0) = "INVNO;" & taxinvno & ";True"
    'CrystalReport1.ParameterFields(0) = "INVNO;" & inv() & ";True"
    CrystalReport1.Destination = crptToWindow
    CrystalReport1.WindowState = crptMaximized
    CrystalReport1.WindowShowExportBtn = True
    CrystalReport1.WindowShowPrintBtn = True
    CrystalReport1.WindowShowPrintSetupBtn = True
    CrystalReport1.Action = 1
    CrystalReport1.Reset
    
    Exit Sub
ErrHandler:
    MsgBox Err.number & " : " & Err.Description
End Sub

I really need help.

GoodGuy
Experience is a bad teacher for its exams precede its lessons.

Creating Parameter Of A Return Value Of A Stored Procedure
Hi all,

How can i create a parameter of a return value of a stored procedure? Thanks!

Parameter Passing When Creating/Opening Window
How do I create/open a form window with an argument.

such as in Createwindow( frmTest, hWndOwner, parameter1,...parametern)

How To Use The Date Format In A Parameter When Creating A Datareport
I'll querying an MS-Acces database by using the dataenvironment and create an datareport in VB6
this query wil find records in an variable time periode. So I query an date field.
I have placed this datefield in the parameter of the dataenvironment . and i have not find any way how to get the correct data out of the database
when i typed in an date then everything works fine. Except when I use the date parameter

Does anybody have an solution for this

 

Running Parameter Query On A Recordset With Multiple Records
I am trying to run a query on a recordset with 300 records. the 300 records are customercodes, the customercodes are parameters in a query that appends data from one table to another. The code i am using is below but it only runs the query on the first customercode in the recordset ignoring all others
With adoRec

Do Until .EOF

run query here

.MoveNext

Loop
End With

can anyone suggest why this wont work and how I could make it work? Any thoughts would be apreciated
Thanks

Help With Creating Objects
I want to create multiple lines using code. I think I need to make an array. Lets say everytime I clicked I wanted to create a different line, how would I do that? TIA for any help.

Creating Objects On The Fly
Howdy

Alright...I have an array of two images (Image(0), and Image(1)). I want to be able to (when a button is pressed inthe program) create another image in that array and add it to the end of the array. And i want to do this while the program is running. Is there a way to create objects while the program is running?......My other way would be to create the 400 images before i run the program and just have them sitting there, but that would take a lot of time and I just don't really like that idea ....so if anyone knows how to create objects (Image, PictureBox, TextBox, etc.) with the code then please....share the knowledge

Thanks

Creating Objects
Ok another question...
how can i load or create objects during runtime??
i know how to make regular objects i use...

Load OBJECTNAME(OBJECTNAME.Count)

however this requires an index value and Forms don't have one.
so how can i do something similar to this??? (Creating forms)

THANX
=LP= [img]images/icons/crazy.gif[/img]

Creating Your Own Objects Need Help
I want to create my own object.

Like person1
I want it to have charachteristcs like

person1.name = "Will"

How do I set this up to work.

If you do not understand just post that you don't and I will try to clear it up

Creating Objects
How do I create object arrays from nothing? I'm aware that I can create an object that already exists over and over, but can I do it without putting one on the form first?

Creating New Objects?
I am currently tying to create an object using a high level object (i.e. obj.Part1), I also have a string which makes up the rest of the object (i.e. ".Part2.Part3.Part4")

How can I put the string to the object I currently have to create the object I require

obj.Part1.Part2.Part3.Part4

It's driving me mad.

Creating Objects
how do i create an object in VB? like a button where i can set its own attributes.

Like have blocks where i can state that block 1 is south of block 2...

so i can map out 2d arrays.

anyone out there?!?! that can help me hehe

thanks

steve

Creating Objects From A DLL
Hi, please, can anyone help?
i have a DLL in same directory with my App. within my VB code, am creating object from it. i have added the DLL to the app using Reference menu item from the project menu in VB IDE, but when i moved the whole folder containing d App and DLL, i get the error below:
Active X cannot create object

way out?

Objects Creating
How can you create objects such as buttons and labels threw code instead of dragging them into your project.

sample code would be nice

thanx in advance

Creating Objects
In my program, when the user presses a start button, I create an object of an activeX.dll. During the run of the program, the user is allowed to see a form or not see a form that is part of the dll. The problem is, I need to know how to determine if I have already created the object or not.

My code is something like this:

Set ObjServer = CreateObject("myproject.clsMyClass")
objServer.StartProgram


When the clien app is loaded, this above code does not occur unless they want to start the process. However, they can just choose another button which will show a form in that DLL. the code is this


if objserver has been set then
Objserver.ShowLogForm
Else
Set ObjServer = CreateObject("MyProject.clsMyClass")
ObjServer.ShowLogForm
end if


I need to know if the object was created yet?

Creating Objects...?
Hi there!

I am an experienced VB user, but there's this one thing that's been on my mind for some time now... How can I create an object (let's say, an Image box) on a form WHILE the code is running? I know there is a command, object.CreateObject, but VB Help is so precise sometimes, and the only examples it gives is about how to create an Excel worksheet (which I do not need!).

Many Thanks in advance!

Kor
----
"Only the fool stands up to the wind"

CREATING OBJECTS!!!!!!!!!!
Final plea for help

Okay now only respond if you KNOW how to do it or you're an experienced programmer and know it's not possible.

How do you create objects on a form during runtime???

-Justin

In a dungeon of Britannia a tamer says, "All Release".

Creating Objects
I've been wondering this for a long time. How do you create objects on a Form.

For example how would I during runtime make a picture object(s).

Thx for any help!

-Justin- "Lost UO Roleplayer"

Creating Objects....
Ive got a string "frmMyform" and i want to create a new frmMyform now, how do i do it using that string. (without a huge select case through the string) ?

This is what i want to do basically:

dim ofrm as form
set ofrm = new "frmMyform"

i dont want to:

select case String
case "frmMyform"
set ofrm = new frmMyform

Creating Objects In VB 6.0?
Hi there,

I am currently getting to grips with VB 6.0 (yes, I know - I should go with .NET; but I may have to maintain some applications written in VB 6.0 ).

I am currently reading an excellent book called Visual Basic 6.0 Professional Step By Step (2nd Edition) - I highly recommend this book to anyone looking to use VB 6.0 and is a beginner - but I couldn't see anything on creating custom Classes/Objects. Can you create your own custom objects in VB 6.0? I have checked the web for tutorials on VB 6.0, but the ones that I have found don't cover this topic. I did read something in my book regarding user-defined Data Types, but the explanation and example given didn't extend beyond a very basic illustration.

Any pointers in the correct direction would be gratefully received.

Thanks in advance.

Working On Multiple Objects
How to work on multiple objects - for example, having several textboxes, how to change their text field using one call/loop?
They are named Text1, Tex2, etc.

Wait For Multiple Objects
Hello all,

I am using waitforsingleobject(API) to wait for one application/process. But my problem comes when I my called application starts second process. At that time my application hangs. I tried with waitformultipleObjects but that is not working properly.

Thanks in advance

Multiple ADO Recordset Objects
Hi,

I have a situation where many procedures of a form are using a ADO connection declared under the General section of the form code:


Code:
Option Explicit

Dim db As New ADODB.Connection
Dim rst As New ADODB.Recordset
.................................
.................................
Now inside one of the procedures I need to define a separate recordset object,say "rst1" using the same connection object "db".

Do I need to use the 'NEW' keyword to create a new instance of the recordset object variable inside the procedure or is it not necessary to use 'NEW'?


Code:
Private Sub readdata()

Dim rst1 As New ADODB.Recordset


or,


Code:
Private Sub readdata()

Dim rst1 As ADODB.Recordset


Which of the two should I use & why?

Thanks in adavnce.

Multiple Objects Under One Roof
I have multiple objects, which form part of another object. For ease of understanding, they are

Mailing - which is the main object.

...and

AddressData - which holds company name, street details etc.
ExtdAddressData - which holds salutation, first name, surname, country etc.
MailsortData - holds details of what zone the address is going to, etc.
Baglabel - holds details of number of addresses to certain locations.

My app adds addressdata to the AddressData and /or ExtdAddressData object(s) and adds the filled object to the Address object(s) held in Mailing.

Question - Instead of having to set each object to other objects each time, how can I add a main class so that all I have to say is something like


Code:
Set AddressDetails =Mailing.AddressDetails

Multiple Objects Equals....
Can I make more than one object get the same value like:

Text1.Text, Command4.Caption = "Test"

Now I know this doesn't work, but can it be done?

Coding Multiple Objects
Hi

I have the following code:

Private Sub txtStud7_AfterUpdate()

'//To make the Jamb Width change according to:
'//Stud Width and Jamb Profile

'DEFINE VARIABLES
Dim JAMB As Integer
Dim stud As Integer

'INPUT

stud = Int(txtStud7)

'PROCESS
'If Profile is Architrave, then Jamb = Stud + 22
'If Profile is Grooved, then Jamb = Stud + 45
'If MUF Grooved, stud 70, then Jamb = Stud + 51
'If MUF Grooved, stud 90, then Jamb = Stud + 52

If stud = 0 Then
MsgBox "Please enter required Jamb size", vbExclamation, "Enter Jamb Size"
JAMB = 0
txtJamb7.SetFocus
GoTo 16

ElseIf comJMaterial = "Pine" And ComJProfile = "Flat" Then
JAMB = stud + 22
ElseIf comJMaterial = "Pine" And ComJProfile = "Grooved" Then
JAMB = stud + 45
ElseIf comJMaterial = "MUF" And ComJProfile = "Flat" Then
JAMB = stud + 22
ElseIf comJMaterial = "MUF" And ComJProfile = "Grooved" And stud = 70 Then
JAMB = stud + 51
ElseIf comJMaterial = "MUF" And ComJProfile = "Grooved" And stud = 90 Then
JAMB = stud + 52
ElseIf ComJProfile = "Flat" Then
JAMB = stud + 22

End If


'//Reminds user to change Jamb size depending on lining type
If vbNo = MsgBox(prompt:="Jamb size is based on 2 layers of 10mm Gib - Okay?", Buttons:=vbYesNo + vbQuestion, Title:="Confirm Lining") Then
MsgBox "Please alter Jamb size accordingly", vbExclamation, "Change Jamb Size"
JAMB = 0
End If

'OUTPUT
txtJamb7 = Str(JAMB)
txtJamb7.SetFocus
16
End Sub


It works how I want it to, but the problem is that I have 26 each of the txtJamb* and txtStud* boxes. Every time I make a change I have to change 26 pieces of code. The only difference between each one is the number at the end of the txtJamb* and txtStud* boxes. Is there a way to write one piece of code for all 52 boxes?

Thanks

Opening Multiple Com Objects
I have a NT service written in VB, I want this service to monitor several mail boxes and when new mail arrives call a COM DLL or EXE to deal with the incoming mail. Each mailbox may have its own Dll or Exe registered with MTS.
I am a web developer and I am quite new to VB so the following question may be somewhat trivial:

Question

Can the VB service call a COM object and let it run without having to wait for it to finish. I already have used COM objects from a mail agent but these wait till the COM object has finished executing before it can move on. The COM object will have their own error handling.

I know VB is not truly multithreaded but is it still possible to have multiple Com objects opened from the same service and executing at the same time, even if this does mean CPU sharing in VB.

Thanks,
Sean Martin

Help Creating And Handling A Map And Objects
I'm still pretty new to VB but have been mostly doing scientific programming over the past several years. Right now i've been tasked with a job and i've been going no where all week. Here's what I ultimately need to do:

1.) Create a map of the world (just politcal boundaries)
2.) Display this map and allow the user to zoom in and out
3.) Allow the user to add a marker to places they click on the map
4.) Allow the user to remove a marker already on the map.

I have data to construct a world map. I have done this in EXCEL and want to use it as a vector image of some sort, with the hope of lossless zooming.

I have tried putting the chart in several picture boxes, image boxes, OLE's, but nothing fully works right. To try to tackle zooming I have been using on mouse events to draw a dashed rectangle over the image. Sometimes creating this box results in Major flickering, sometimes simply does nothing, or other times draws it, but flickers and appears in the wrong place. If anyone can suggest a path to follow or point me in the direction to what I can learn or need to do this task the easiest (it doesn't have to be pretty, just functional), I would greatly appreciate it.

Creating GUI Objects Dynamically
I am trying to create edit boxes and labels according to an array, which may vary in the number of records. So instead of drawing a bunch of objects on the form, I want to make the code create these objects. How do I do this?

Creating Objects During Runtime.
hey,

I have a checkbox listbox filled up with records from the database: "name" fiield.
The user of the program can check names in the listbox for which they want to change data in the database.


Code:

Dim memberName(0 To 10) As String
Dim intCount As Integer
Dim intSelected As Integer

Private Sub cmdEditStats_Click()
Do While intCount <= lstMembers.ListCount - 1
If lstMembers.Selected(intCount) = True Then
memberName(intSelected) = lstMembers.List(intCount)
intSelected = intSelected + 1
End If
intCount = intCount + 1
Loop
end sub
This is the code i use to save the checked names into an array.
What i want is that for every name in the array a textbox gets created during runtime. The user of the program can fill in data in the textbox and then click on a button to save the data to an array.

Anyone have an idea how i can do this?
Dont necessarily need to be a textbox. if someone has a better solution its ok too. (i dont want to do it with inputboxes.)

thx in advance.

Creating Objects At Run Time?
is it possible? it seems to be - i can name an object and make it a certain class (dim txtNew as textbox), but once that's done i don't know what to do...

what i want to do is create certain objects when needed (i'm trying a textbox, but i really want to be able to do an msflexgrid) and put it on a form and then be able to use it...

i'll try to give an example

form loads - there is nothing on it... but i have data loaded already

i click on "create grid"... the program creates an msflexgrid. then i have code to format it how i need it (cols, rows, format style, etc), then it populates the grid with some other code...

i know that i could just make the grid and make it's visible property false - then show it when the button is clicked... but what i want to do is have most of the functions of the program run on one form (mostly) - so i'd rather just have code that creates the objects and places them where i need them... it gets too cluttered up if i design everything ahead of time...

if i can't do it then i guess i'll just use an sstab - but i'd rather not.

Help With Dynamically Creating Objects
I am making a simple, Tetris-style game in VB 6. But in generating a random brick I get the - Type Mismatch - Error

The code I have used is some code I have used before, that worked fine for creating an object in Form_Load(), but when using it in randomized Subfunctions I get the error.

Can Somebody PLEASE Tell me what I have done wrong!
- for all I know it could be a typing mistake.


Here is the code anyways...


Code:
Dim WithEvents RandomBrick As VB.Shape
'------------------------------------------

Private Sub RandomizeNextBrick()

Dim SelectNext As Integer

SelectNext = Int((4 * Rnd) + 1)


Select Case SelectNext

Case 1

CreateBrick1

Case 2

CreateBrick2

Case 3

CreateBrick3

Case 4

CreateBrick4

End Select

End Sub

'------------------------------------------

Private Sub CreateBrick1()

Dim RandomBrick As VB.Shape

Set RandomBrick = Controls.Add("VB.shape", "Brick", Form1)
RandomBrick.Visible = True
RandomBrick.Move (Shape165.Left), Line6.Y1, 495, 495

End Sub

'------------------------------------------

Private Sub CreateBrick2()

Dim RandomBrick As VB.Shape

Set RandomBrick = Controls.Add("VB.shape", "Brick", Form1)
RandomBrick.Visible = True
RandomBrick.Move (Shape165.Left), Line6.Y1, 975, 495

End Sub

'------------------------------------------

Private Sub CreateBrick3()

Dim RandomBrick As VB.Shape

Set RandomBrick = Controls.Add("VB.shape", "Brick", Form1)
RandomBrick.Visible = True
RandomBrick.Move (Shape164.Left), Line6.Y1, 1455, 495

End Sub

'------------------------------------------

Private Sub CreateBrick4()

Dim RandomBrick As VB.Shape

Set RandomBrick = Controls.Add("VB.shape", "Brick", Form1)
RandomBrick.Visible = True
RandomBrick.Move (Shape164.Left), Line6.Y1, 1935, 495

End Sub


Thanks.

--- Tom.

Creating Objects At Runtime
How can I create for example an image object or several image objects at runtime?

Auto Creating Objects?
Is it possible for a program to create labels on its own as it needs? Anyone know?

Creating Objects On Form_Load
I'm having a problem creating objects on my forms, but I think its doable.
I have user input data coming into a main form, for example Number of Students = 6. That then creates 6 SStabs and I am trying to set up the form in Form_Load. I just need textboxes and labels but can't get it to work. Is this on the right track? Or am I going about this all wrong? There will be about 6 inputs for each tab.

SSTab1.tab(i).add txtTest, "Text", "Test"

Creating And Duplicating Objects
So, I was wondering how one could go about duplicating an object. Lets say you have an array of labels, and you want to add one more label in that array to the form. How would you do this?

Thanks in advance....

Creating Objects At Runtime
How would I create an object such as a command button at runtime?

I have a touchscreen application where a command button must be created for each user as they login to the program.

Creating Objects In Run Time
Is it possible to create new objects in run time? If so, how would I go about doing it. I know how to create new forms in run time but not other objects (eg. label boxes, images, etc.)

Creating Objects At Runtime
Is there any way to create objects at run-time? ie: ask the user how many entries he wishes to enter and then create that many text boxes. If not, what would be an easy way to accomplish this task?

Creating Objects In Run Time
How do you creat an object (like an image, or command button) in run time?

Creating Objects And Tab Control
I am using the Microsoft Tab ActiveX Control on my form. Like it much better than the Tabstrip control. Very easy to set up at design time.

But, now I have run into a scenario where I need to add an undetermined amount of tabs at runtime. I've figured that part out, and I think I have figured out how to add controls at runtime. My problem is how to create these new objects on the right tabs.

The tab control takes care of hiding and showing the right controls if they are created at design time. But how in the world do you create controls on the right tabs during runtime?

The first tab, and all the controls it needs, would be set up at design time. Each new tab would be a "copy" of this first tab. There are 2 control arrays included in these objects.

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