Talk2Tom11 Posted March 15, 2004 Posted March 15, 2004 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 Quote
Denaes Posted March 15, 2004 Posted March 15, 2004 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. Quote
ballisticnylon Posted March 15, 2004 Posted March 15, 2004 you wouldn't really be adding items, just concatenating additional text. Textbox1.Text = "Thing1" Textbox1.Text &= " Thing2" Is that all you meant? Quote "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
Leaders dynamic_sysop Posted March 15, 2004 Leaders Posted March 15, 2004 you can use AppendText , eg: TextBox1.AppendText(" item to add to the textbox") Quote
Talk2Tom11 Posted March 16, 2004 Author Posted March 16, 2004 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? Quote
Leaders dynamic_sysop Posted March 16, 2004 Leaders Posted March 16, 2004 TextBox1.AppendText(" item to add to the textbox" & Environment.NewLine & "next item to add") Quote
Denaes Posted March 16, 2004 Posted March 16, 2004 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 Quote
Denaes Posted March 16, 2004 Posted March 16, 2004 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? Quote
Administrators PlausiblyDamp Posted March 16, 2004 Administrators Posted March 16, 2004 I'd go with Environment.NewLine myself - works in all .Net languages. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.