Hello everyone.

I am trying to make a simple, one lined text field, which permits users to enter text into it. The text field I am reffering to is the type that has a carriage return blinker to signify that a user can type there.

I have looked up "text boxes" but those are used to just display text, but not permit users to type anything into them.

Please help.

(Also, if it is possible, how can I store the information the user types into the field, into a variable?) Thanks in advance.

Recommended Answers

All 6 Replies

Depending on what system you are using textboxes can be read only or read/write. What are you trying to write this in (Win32 API, MFC, Winforms)?

Like jonsca said. we need to know what your using. if its Windows Forms in Visual C++ then all you do is drag and drop a textbox and set its properties in the properties window.

then double click it and now you can code it.

if you want to try somthing. let the user put text in the textbox then make there text apear in a read only box. this is simple to do. you just put two text boxes in a form. make one read only in the proerties window. then put a button in.

from there double click the button. then store the information into a string.
somthing like this

String^ usertext = this->textbox1->Text

then you can put that text into the other text box like this.

this->textbox2->Text = usertext;

you can do much more but that is the basis you kinda need to know. you can even code it without storing it into a string. but i find its helpfull if you want to do somthing like compare there text to somthing.

i.e. for a user system. you might want to use a if statment to compare input a user entered like a password. you can have a signup section that takes user input then a login that checks it to the input that they entered. thats when its usefull to use strings.

Sorry, I'm trying to make a "textbox" in pure Win32 code.

I can't help much, but I can say that usually what you are referring to is called an "edit box" not a text box. That might help you in your web search.

oh ok well i cant help you much there sorry. i userly use VC++ eighter that or you need to find what liberies are needed and what are included with your compiler to find out what can make the text box.

eighter that or you hard code the libery's to do what you want. but i recomend the VC++ its got it all included. if your not already using microsft VC++

I've found the solution. It's done via the "GetWindowText" function and indeed, an editbox. Thanks for your help guys.

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.