mbacarra Posted September 14, 2005 Posted September 14, 2005 well, my groupmates and i are working on a project. we're creating a new programming language and we're using c#. i'm new to this obviously that's why i need all the help i can get. i have a tabcontrol where i can programmatically create a textbox added in a tabpage in the said tabcontrol using the "open" and "new" on my menu. i was able to do the "open" menu by reading from a file and setting it as the text of an instantiated textbox added in an instantiated tabpage. the problem is i cannot get the text from a textbox so that i could create a file and "save" it there. please help me. i would really appreciate your help! thank you very much! Quote
*Experts* Nerseus Posted September 14, 2005 *Experts* Posted September 14, 2005 I'm confused as to what you're doing (we're creating a new programming language...?). But, to save out the contents of a textbox to a file: System.IO.File.CreateText("c:\\test.txt").Write(textBox1.Text); That's all in one shot, obviously you should break that down and check for errors, etc. You said you needed something asap, and I hate that kind of pressure! A lack of planning on your part does not constitute and emergency on my part Good luck with the assignement! -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
handlewithbeer Posted September 14, 2005 Posted September 14, 2005 Will a newly instantiated textbox actually contain the text that was in it, or just the properties of the object itself? If I am reading this correctly, maybe try to save the text from the box in a .txt file, then instatiate the new textBox object, then add the saved text to the new textBox. Quote
mbacarra Posted September 15, 2005 Author Posted September 15, 2005 I'm confused as to what you're doing (we're creating a new programming language...?). But, to save out the contents of a textbox to a file: System.IO.File.CreateText("c:\\test.txt").Write(textBox1.Text); That's all in one shot, obviously you should break that down and check for errors, etc. You said you needed something asap, and I hate that kind of pressure! Good luck with the assignement! -ner it's a project. our task is to create a programming language. you know, i wouldn't ask something i already know, and if you're pressured, then don't. i was asking people in this forum who 'can' and 'are willing to' help. and i said "i need help asap" because we have a deadline, and as i've said it's a project. i came here to ask for help, because i am not knowledgeable with such stuff. compared to you, i'm just a neophyte. Quote
mbacarra Posted September 15, 2005 Author Posted September 15, 2005 clarifications ok here's the thing. i have a tabcontrol that programmatically creates tabpages with a textbox in it. i have a menubar with "open", "new" and "save" menu in it. the "new" menu creates a tabpage with a blank textbox. the "open" menu opens and reads files (under a filter), then creates a tabpage with a textbox containing the data inside the file. think of it as a notepad, only you can open multiple files via the tabcontrol. here's the problem. the save menu is supposed to create a file, reads the text on textbox of a selected (current/active) tabpage and writes it on the file. what i was asking before was how can i access the text on the textbox that was added in a tabpage,which, of course,is added on the tabcontrol i hope that clears some of the questions. Quote
Machaira Posted September 15, 2005 Posted September 15, 2005 DirectCast(TabControl1.SelectedTab.Controls(0), TextBox).Text This of course assumes you have only the textbox in each tabpage. Quote Here's what I'm up to.
IceAzul Posted September 15, 2005 Posted September 15, 2005 Since your using C# thats ((TextBox)TabControl1.SelectedTab.Controls[0]).Text Quote
mbacarra Posted September 16, 2005 Author Posted September 16, 2005 *applause* It worked!!! thanks a lot! and i really mean A LOT! *whew* and to think i was trying to figure that one out since a few weeks ago. thanks a lot! Quote
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.