5 Replies - 526 Views - Last Post: 30 March 2012 - 10:19 AM Rate Topic: -----

#1 gm5660  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 12-August 08

array to array

Posted 29 March 2012 - 03:56 PM

Hi all. I am working on a little project and have had great success, that is until I came upon a slight glitch in programming. Here is the glitch:

I have Form1 and Form2. Form1 contains an array, which I need to send to form2 to precess and send on. Is this possible? I have tried sever ideas and none have worked. Can anyone tell me if sending an array from one form to another is possible?

Thanks for all the help and info. Any direction is greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: array to array

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: array to array

Posted 29 March 2012 - 04:04 PM

If you're just passing the array I believe you may be able to use a Public Property within Form2:
Put this in the form declarations
Dim theArray As Array

Then add this code:
Public WriteOnly Property ArraytoSend As Array
Set (ByVal are As Array)
theArray = are
End Set
End Property


Then you could run a sub that processes the newly set theArray object.
:)
Ps: I'm interested to know if this will work
EDIT: right again, HAWK!

This post has been edited by DimitriV: 29 March 2012 - 09:17 PM

Was This Post Helpful? 0
  • +
  • -

#3 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: array to array

Posted 29 March 2012 - 04:09 PM

There will be a green underline somewhere in the Get…End Get code as you are not returning any value. Don't worry about it.
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,100
  • Joined: 02-July 08

Re: array to array

Posted 29 March 2012 - 08:23 PM

If your not going to use the Get/End Get it sounds like a WriteOnly Property!
Was This Post Helpful? 0
  • +
  • -

#5 gm5660  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 12-August 08

Re: array to array

Posted 30 March 2012 - 09:27 AM

I tried the Public WriteOnly Property code and it was working until I coded in (ByVal... I got an error message: Array Bounds cannot appeaer in TypeSpecifications. What is this error message telling me? Can anyone explain this error message to me?
The code I am usin for Form1 is:
Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

        Form2.Show()

        Dim numbArray() As Integer = {11, 22, 33, 44, 55, 66, 77, 88, 99}
        Dim count As Integer = 0


        For count = 0 To 8
            Form2.TextBox1.Text = numbArray(count)
            TextBox1.Text = numbArray(count)

            Refresh()
            System.Threading.Thread.Sleep(1000)

        Next

    End Sub
End Class
[\code]

The code for Form2 is:
[code]
Public Class Form2
    Inherits System.Windows.Forms.Form
    Dim itemArray() As Array

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim x As Integer


    End Sub
   Public WriteOnly Property numbeArray as arrayset(ByVal arc as array)
        Set(ByVal value As arrayset())

        End Set
    End Property
End Class
[\code]

I tried the Public WriteOnly Property code and it was working until I coded in (ByVal... I got an error message: Array Bounds cannot appeaer in TypeSpecifications. What is this error message telling me? Can anyone explain this error message to me?
The code I am usin for Form1 is:
[code]
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

Form2.Show()

Dim numbArray() As Integer = {11, 22, 33, 44, 55, 66, 77, 88, 99}
Dim count As Integer = 0


For count = 0 To 8
Form2.TextBox1.Text = numbArray(count)
TextBox1.Text = numbArray(count)

Refresh()
System.Threading.Thread.Sleep(1000)

Next

End Sub
End Class



The code for Form2 is:
Public Class Form2
Inherits System.Windows.Forms.Form
Dim itemArray() As Array

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim x As Integer


End Sub
Public WriteOnly Property numbeArray as arrayset(ByVal arc as array)
Set(ByVal value As arrayset())

End Set
End Property
End Class


Was This Post Helpful? 0
  • +
  • -

#6 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,100
  • Joined: 02-July 08

Re: array to array

Posted 30 March 2012 - 10:19 AM

So many things wrong with that!

How about:

Private _arrayprop As Integer()
Public WriteOnly Property arrayprop() As Integer()
      Set(value As Integer())
         _arrayprop = value
      End Set
End Property


Use _arrayprop in that form.

This post has been edited by _HAWK_: 30 March 2012 - 10:28 AM

Was This Post Helpful? 2
  • +
  • -

Page 1 of 1