Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I know that with a listbox you can have something added to it, and then add something else without clearing the stuff before it. But I was wondering there was a way to add Items, to a textbox as well? of so please post
Posted

Nope.

 

You can make one yourself though by extending the base textbox and making your new control for it.

 

Wether you want to make a new one entirely or just add it to your project, you'll need a collection.

 

In the collection you can add an item or an item and a string (like a name for it)

 

You can get the information from your collection via its index (automatically indexed) like a listbox, or if you gave it a string "Key", you can get it back with that.

 

Note, you can also use a combobox. There are three 'dropdown' methods, two allow you to put in text. The first option is flat out just a textbox with a scrollable (by pushing up/down I believe) combo list, it has no actual dropdown.

Posted

you wouldn't really be adding items, just concatenating additional text.

 

Textbox1.Text = "Thing1"

Textbox1.Text &= " Thing2"

 

Is that all you meant?

"It may be roundly asserted that human ingenuity cannot concoct a cipher which human ingenuity cannot resolve."

 

- Edgar Allan Poe, 1841

 

I long to accomplish great and noble tasks, but it is my chief duty to accomplish humble tasks as though they were great and noble. The world is moved along, not only by the mighty shoves of its heroes, but also by the aggregate of the tiny pushes of each honest worker.

 

- Helen Keller

Posted

I am using this lst code you send:

 

TextBox1.AppendText(" item to add to the textbox")

 

it works... but I have one more question... if I want to add two items to the textbox at once... on seperate lines... how would I do that?

Posted
I am using this lst code you send:

 

TextBox1.AppendText(" item to add to the textbox")

 

it works... but I have one more question... if I want to add two items to the textbox at once... on seperate lines... how would I do that?

 

vbCRLF is Visual Basic's "Carrage Return & Line Feed"

 

"This is line 1" & vbCRLF & "This is line 2"

 

would have two lines. Just make sure your multi-line property is set to True.

 

Sorry if I mistook your inentions in the first post :p

Posted
TextBox1.AppendText(" item to add to the textbox" & Environment.NewLine & "next item to add")

 

Which is better to use, vbCRLF or Environment.NewLine?

 

All the books I have use vbCRLF. I guess Environment.NewLine is the .Net managed way to do it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...