# need vb.net help



## nocompknowl (May 14, 2002)

alright it should be a simple question, im in class right now tryign to figure out how to make text go to the next line in a listbox, but it goes to a single line instead of moviing down the listbox, what properties do i change, respond quick cause i want to finish this, thanks


----------



## Mosaic1 (Aug 17, 2001)

I don't have NET I have 6.
I'll get you started. 

Remember the entries in a listbox are an array. But then what? You are going to have to sort the array. What exactly do you want to do? Move an entry one up on the list. But what happens to the entry you are replacing. It will disappear. And the entry being moved will appear twice.


----------



## nocompknowl (May 14, 2002)

ok ill give you my problem we have to do, we are doing madlibs in class and each adjective, etc.. is a text box that the user inputs in and when its filled in, it displays the story, i did everythign right but it displays on a single line instead of going down the list box.
what do i change to change that?


----------



## Mosaic1 (Aug 17, 2001)

Do you have some code?

Here's the thing. You said the input is from text boxes but you are displaying it in a ListBox? And it shows as only one line. If you are saying, for example that Text1.text is a string, then adding that string to the list box, it will show as one line. If, however, it is showing in a text box as one line, you have to set the Multiline property to true and add a scroll bar. Adding a horizontal scroll bar keeps the text from automatically wrapping. So you have control over where the linefeeds are located. But first, we need to establish how many and what types of controls you have on the form. Are the text boxes individuals or did you create a control array etc. 


If you post details, we can help to get you started. But we won't be able to do your assignment for you.

Please post the specifics. The best way to get help is to submit whatever code you have, how your form is set up and the original goal.

As it stands my best guess is that you have a text box to which everybody has added one line. You want to display the contents of the text box line by line in a list box. 

To do that you would have to split the contents of the textbox into an array using vbcrlf as the delimiter.

Unless each line is only one word. Then you could split the text box string using the default(space) as the delimiter.
Each member of the resulting array would be added to the listbox. 

However, I am still not certain what you are trying to do. 

In Help, have a look at String Manipluation for some help>> The split function.


----------



## Mosaic1 (Aug 17, 2001)

Have a look at this screen shot.(attachment below) I split a textbox line by line. Exactly the same code. 
Look at the two different results I got.

Same code word for word EXCEPT:
When I used an Input Box and asked the User to Input how to split the string, I got the single line.


The first three lines I got using a different command. 

I split using vbcrlf in the Function and not a variable.


I tried this using two completely different String Functions and both were the same.
If I wrote the delimiter into the code and ran it, I got separate lines in the ListBox.

If I used a variable, I did not. 

Does this look like your problem?


----------



## nocompknowl (May 14, 2002)

thanks guys, it was what you assumed, but i just did it a different way instead of wrapping, i just made 16 listbox1.items.add and put a qoute and the input on each line, that was the best i coudl do in the little time... bu thanks ne ways might need you some other time...


----------

