Modular Array issue

  • Thread starter Thread starter zoneal
  • Start date Start date
Z

zoneal

I have an array declared as Public in a standard module and wish to
pass data from a combobox located on a form. The Combobox takes it's
data source using the Add method as follows:-

Sp_Cmb_Ac_Volt.Items.Add(110)

Sp_Cmb_Ac_Volt.Items.Add(120)

Sp_Cmb_Ac_Volt.Items.Add(230)

Sp_Cmb_Ac_Volt.Items.Add(240)

'Power Factor

Sp_Cmb_Pf.Items.Add(0.6)

Sp_Cmb_Pf.Items.Add(0.65)

Sp_Cmb_Pf.Items.Add(0.7)

Sp_Cmb_Pf.Items.Add(0.75)

Every time I try to get data back to the array I get problems. Can
anyone help?

Here's the Array declaration

Public Sub main()

Dim record_inf(0, 6) As String

record_inf(0, 0)

record_inf(0, 1)

record_inf(0, 2)

record_inf(0, 3)

record_inf(0, 4)
 
I have an array declared as Public in a standard module and wish to
pass data from a combobox located on a form. The Combobox takes it's

Every time I try to get data back to the array I get problems. Can
anyone help?

What problems? You will have to be more specific. Are you getting an
exception?
Dim record_inf(0, 6) As String

This line create a 1 x 7 multi-dimensional array of strings
record_inf(0, 0)
record_inf(0, 1)
record_inf(0, 2)
record_inf(0, 3)
record_inf(0, 4)

You seem to be missing some code. What are these lines supposed to do?
 
I have an array declared as Public in a standard module and wish to
pass data from a combobox located on a form. The Combobox takes it's
data source using the Add method as follows:-

Sp_Cmb_Ac_Volt.Items.Add(110)

Sp_Cmb_Ac_Volt.Items.Add(120)

Sp_Cmb_Ac_Volt.Items.Add(230)

Sp_Cmb_Ac_Volt.Items.Add(240)

'Power Factor

Sp_Cmb_Pf.Items.Add(0.6)

Sp_Cmb_Pf.Items.Add(0.65)

Sp_Cmb_Pf.Items.Add(0.7)

Sp_Cmb_Pf.Items.Add(0.75)

Every time I try to get data back to the array I get problems. Can
anyone help?

Here's the Array declaration

Public Sub main()

Dim record_inf(0, 6) As String

Well, you didn't actually declare your array as public. You declared it
inside a method.

\\\
Public Module Program
Public RecordInfo(0, 6) As String

Public Sub Main()
Application.Run(New MainForm())
End Sub
End Module
///

In your main form:

\\\
Program.RecordInfo(0, 0) = Me.ComboBox1.Items(0)
....
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top