Displaying Text inside a txtBox

Sharky Forums


Results 1 to 8 of 8

Thread: Displaying Text inside a txtBox

  1. #1
    Sushi
    Join Date
    Jul 2001
    Posts
    2

    Question Displaying Text inside a txtBox

    Displaying Text inside a txtBox

    Does anyone know how to do this? I have already declared a variable, and I just want to dump the contents of the variable (a txt file) into a text box -- and later parse this information.

    I've played around with debug.print, but is there a way to dump that data into a text box?

    Thanks

  2. #2
    Reef Shark
    Join Date
    Apr 2001
    Location
    Austin, TX
    Posts
    371

    Post

    It all depends on what widget set you are using. Microsoft has a huge repository of info on MFC, and just plain Win32 if you need info go to msdn.microsoft.com.

    If you're using GTK/GTK+, then you'll need to go to gtk.org. If you need QT info, then check out www.trolltech.com/products/qt/

    ------------------
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}

  3. #3
    Sushi
    Join Date
    Jul 2001
    Posts
    2

    Question

    What is a widget set? I'm assuming you mean programming language? In that case i'm using VB.

    BTW, i did txtBox.text = variable and it didn't work

    The way I have it setup is that there is a cmdButton -- when you click on it it brings up a file open dialog. right now when you double click on the file the text box displays the LOCATION of the file (ie: c:\temp\file.txt)

    I would like to figure out how to display the CONTENTS of the text file within that text box.

    Thanks

  4. #4
    Goldfish Strike's Avatar
    Join Date
    Feb 2001
    Posts
    68

    Post

    if i understand your question correctly...all you do is set the forms value = to whatever you want in it...which can be done in either the javascript or the html

    &lt;form name="blah"&gt;
    &lt;input type="text" name="result1" size="100" value="your text"&gt;
    &lt;/blah&gt;

    or in javascript, set the value and from there you may be able to specify the file you want, never tried it, but play around with it



    ------------------
    Abscence of evidence is not evidence of abscence.
    Abscence of evidence is not evidence of abscence.

    Athlon XP 2500+ Barton
    Asus A7V880
    AS Ceramique
    1GB PC3200 OCZ Dual
    Zalman 400APS
    MSI nvidia 2 G2Ti Pro
    Plextor PX-716SA
    Supermicro Tower
    WinXP SP2

  5. #5
    Reef Shark biosx's Avatar
    Join Date
    Jun 2001
    Location
    Chicago, IL, USA
    Posts
    448

    Lightbulb

    He's using VB, not HTML nor Java.

    Instead of doing:

    txtBox.text = variable;

    Try just doing:

    txtBox = variable;

    I haven't messed with VB in a while though.

    Hope it helped ya out

    ------------------
    root is the greed of all evil
    ## root is the greed of all evil ##

  6. #6
    Reef Shark
    Join Date
    Apr 2001
    Location
    Austin, TX
    Posts
    371

    Post

    Ooooooooh.. You didn't say you were using VB

    A widget set is basically just a collection of stuff that lets you make a UI. (buttons, labels, forms, etc). If you're programming in C/C++, or Perl for example, those languages don't come with a widget set built in (as part of they're standard library). Therefore, if you want to make your program GUI, you need to take advantage of a widget set's API.

    RAD (rapid application development) tools like Delphi, and Visual Basic come with these things built in, and a slew of language wrappers. For example, to connect to a socket using the FTP protocol, you'll probably just drag and drop the "FTP" control to your form, call a couple of methods, and you're set. If you didn't have that tool available, you'd have to connect to the socket manually, and do all the things it's doing for you behind the scenes. The theory behind these applications is to allow quick generation of front end code to allow rapid prototyping of an applications existance. In the business world, most, if not all, of these applications off-load the "real" work (via COM, DCOM, CORBA, EJB, etc) to other languages more suited to prossesing of the data itself.

    Not to get too diverted lecturing, there is an answer to your problem. The first thing you want to do is make sure your text box is multi-lined because there is more than one line in this text file. I don't know if Visual Basic has a seperate control for this or what. It might be called a "Memo" field, or a "Text Field" instead of a "Text Box" because traditionaly, text boxes are always single lined. You can change this from the text box's properties from the side bar.

    To set the contents of the data to the text field you need to read in each of the lines of the text into some variable. This includes opening the file from a location, reading each line, and appending it to a variable, and then closing the file. Then all you have to do is set the textbox to the variable, and you'll be set.

    Check out MSDN for anything Microsoft related. This is one of the best documentation efforts I've seen for software, even in the face of the Linux Documentation Project... and it's FREE!
    http://msdn.microsoft.com/

    ------------------
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875&gt;&gt;(i-1)*5&31|!!(i&lt;6)&lt;&lt;6)&&main(++i);}
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}

  7. #7
    Reef Shark
    Join Date
    Apr 2001
    Location
    Austin, TX
    Posts
    371

    Post

    After searching a bit, here's the example I came up with. I think this is exactly what you are trying to accomplish:
    http://support.microsoft.com/support.../Q109/3/93.asp

    The example is for VBA, but it should work properly with a little coaxing.

    ------------------
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875&gt;&gt;(i-1)*5&31|!!(i&lt;6)&lt;&lt;6)&&main(++i);}

    [This message has been edited by reklis (edited July 09, 2001).]
    Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
    main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}

  8. #8
    Catfish
    Join Date
    Apr 2001
    Posts
    115

    Post

    It's been a while, but I think your looking for something like this.

    txtBox.Text = variable;
    txtBox.Show

    if the second line doesn't work try
    Form.Show;

    ------------------
    System Specs:

    POS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •