I have an array on one form. I click a command button, and want that array's data passed to the new form that opens under the same name. How do I do that?
Ah... to have C pointers and all this would be solved
Has to be public, or it has to be passed to the form. Since it is impossible to send data in the Form_Load event, you can either use shared memory segment API's, or pass the variable to another function on the second form that sets the values in the first form.
But in the end this is all way too much overhead. Simply making it public woudl do the trick.
Craig, mailto:sander@cogeco.ca
In the computer industry, there are three kinds of lies:
lies, damn lies, and benchmarks.
A form is an object, which has properties, methods, and events. Public properties can be exposed and referenced just as you would any public property from any object.
object.property where object is the name of the form, and property is the name of the property.
CraigSander's example is right on the money, and as vb5prgrmr has already stated, to expose that property, the property must be declared public.
You can also invoke a form's methods just as you would any other object's methods.
Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
Hi. Here's what I'm actually trying to do. It's a slideshow thing. On Form1 (frmMain), the user selects some images from a FileListBox (FileList) with the multiselect 2. They then hit the SlideShow button, the form is replaced with Form2 (frmSlideShow). Form2 reads from an array that was filled on the first form... which is filled with each selected filename that is multiselected when the button is clicked. I have this code:
[tt]
If FileList.Selected(I) = True Then
For Images() = 1 To UBound(FileList.List(I))
Images() = FileList.List(I)
Next
Me.Hide
frmSlideShow.Show
Else
MsgBox "No images have been selected.", vbExclamation, "Select some images"
Exit Sub
End If[/tt]
I'm getting an "Expected Array" error on the Ubound. Anyone got any ideas?
The reason you are getting the "Expected Array" error message when you call UBound(FileList.List(I)) is because FileList.List(I) evaluates to a String, so the UBound function throws an error because a String is not an array.
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.