Hi again,
I worked out my other problem.
But now am having problems passing an array from one form to a textbox in another.
I have taken items from a listbox and added them into an array.
To pass the array into the following form I have used;

Form printPreviewForm = new PrintPreviewForm(employeeListArray);
printPreviewForm.ShowDialog();

And in the constructor on this new form;

public PrintPreviewForm(Array employeeVariable)
{
InitialiseComponent();
printPreviewTextBox.Text = Convert.ToString(employeeVariable);
}

I was hoping this would put my array taken from the listbox in Form1 into the textbox in Form2 but all that shows up in the textbox in Form2 is "System.String[]"

Any ideas?

Recommended Answers

All 5 Replies

Yep, thats exactly what Id expect it to do, employeeVariable is an array, the toString of which is as you saw telling you its an array of string..

Try checking the "join" function.

What is the "join" function?
Can you explain why it won't work in n00b language. I've only been using C# for 4 weeks!!! = O

Everything in .net is an object, so anything thaat isnt a simple variable type eg, number or string, then it has to have something else specifically tell it what to make into a string..

As for join, type "join" and do a search :) least you have enough of the name to find the answer

Thankyou, I didn't find anything out about Join however I did something and now it works.!

= D

I guess you ended up with a loop etc? Still worth taking a look at join, its a very very very very very very useful function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.