how can I get the content of a textbox into a public array

  • Thread starter Thread starter Jan
  • Start date Start date
J

Jan

I tried to do it on the following way:

public tempArray() as string = textbox1.lines

this works fine in the actuell form2, but I want to ship the content to
form1. So i declared tempArray in a module but I get a error message on
textbox1.lines. I have to declare it, but it is a textbox in form2.

Is there anyone outhere who can help me out??

Thank you very much
 
Yes, declare the array in form one and reference it from form2

form1.tempArray = textbox1.lines

Cheers OHM
 
Hi Jan,

On the assumption that you will only have one Form2, a quick fix is to
declare tempArray as Shared. That way you can access it from Form1 very
simply.

In Form2
Public Shared txtboxLines(0) As String 'it's hardly temp!!

Sub SomethingOrOther
txtboxLines = TextBox1.Lines

In Form1
Sub AndAnother
Dim S As String
For Each S In Form2.txtboxLines
Console.WriteLine (S)

Regards,
Fergus
 
Actually, I was ( Assuming that form1 was the parent ) and implying the
parent. me.parent. etc

Post holiday blues

Cheers OHM
 
Back
Top