• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

Values ListBox of Form1 into Form2(VB 6.0)

I have 2 Form (name: Form1 and form2)

- Form1 have list1,list2(MultiSelect=2). I click choose many row of list1 and list2.

I want, When Click  CmdOk of Form1 then Form2 load 1 MSHFlexGrid.
MSHFLEXGRID of Form2:
- Colum of MSHFLEXGRID is Form1.list2(Select)
- Row of MSHFLEXGRID is Form1.list1(Select)

help me
Thank you!

0
thang74us
Asked:
thang74us
  • 2
1 Solution
 
arif_eqbalCommented:
What do you mean - Row of MSHFLEXGRID is Form1.list1(Select)

Say user selects 5 items from List1 and 3 items from list2

How should it be placed in the FlexGrid???
0
 
thang74usAuthor Commented:
I want creat 1 Public array a(100) as interger in Form2.
And write code in form1: form2.a()= list1.select(i)

but msgbox erorr

Not allowed as public member of object modues

help me
Thank you.
0
 
arif_eqbalCommented:
Yes you'd get that error as Array declaration as Public is not allowed in VB6

So what you can do is have the array as private (simple Dim)

and have a public Function in Form2 called FillArray and pass the Listbox object to it

eg.

Public Sub FillArray(Lst As ListBox)
    Dim i As Integer
    ReDim Arr(0)
    For i = 0 To Lst.ListCount - 1
        If Lst.Selected(i) = True Then
            Arr(UBound(Arr)) = Lst.List(i)
            ReDim Preserve Arr(UBound(Arr) + 1)
        End If
    Next
    For i = 0 To UBound(Arr) - 1
    MsgBox Arr(i)
    Next
End Sub

Call it as this from Form1

Form2.FillArray(Me.List1)

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now