Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 3rd, 2006, 7:29 PM   #1
RAzR Creations
Programmer
 
RAzR Creations's Avatar
 
Join Date: Apr 2006
Location: orange park Fl
Posts: 53
Rep Power: 3 RAzR Creations is on a distinguished road
Exclamation neeed major help with a code

:banana: ok i am making a chore program but uh yah say i have a textbox and i want to be able to save the text in it so it wont change when i turn it off and back on so it will still be in the textbox what do i do?? :banana:
RAzR Creations is offline   Reply With Quote
Old May 3rd, 2006, 7:47 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
You will have to write the text to a file, which is quite easy:

To write:
    
Open "c:\file.txt" For input As #1
print #1, "hello"
Close #1

To read:
  
Open "c:\file.txt" For Output As #1
Do While Not EOF(1)
Line Input #1, data
List1.AddItem data
Loop
Close #1

that should do it for ya. Just copied it out of an old project of mine. Look up a tutorial on reading and writing to files for a more in depth look.
Booooze is offline   Reply With Quote
Old May 3rd, 2006, 8:32 PM   #3
RAzR Creations
Programmer
 
RAzR Creations's Avatar
 
Join Date: Apr 2006
Location: orange park Fl
Posts: 53
Rep Power: 3 RAzR Creations is on a distinguished road
when i use the first code it says bad file mode
RAzR Creations is offline   Reply With Quote
Old May 3rd, 2006, 8:51 PM   #4
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
To read, open for input. To write, open for output. He just got'em backward. I'm sure if you even read the code instead of copy 'n paste, you would've seen it.
OpenLoop is offline   Reply With Quote
Old May 4th, 2006, 12:22 AM   #5
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
lol, my bad. it was a while back. I did have to edit them a bit. bah. owell, all is good :banana: I thought the read code was right as I pulled it out of a program that I still use. surprisingly, I compiled it with the code as 'input' but never save it so it still read output.
Booooze is offline   Reply With Quote
Old May 4th, 2006, 7:26 AM   #6
RAzR Creations
Programmer
 
RAzR Creations's Avatar
 
Join Date: Apr 2006
Location: orange park Fl
Posts: 53
Rep Power: 3 RAzR Creations is on a distinguished road
oh well it still wont put the text from the textbox into the text file
RAzR Creations is offline   Reply With Quote
Old May 4th, 2006, 12:30 PM   #7
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
did you edit it a bit? you didnt just copy and paste did you. Because list1.additem isnt what you want. I'm looking at it now dude, if you make the small shanges yourself you should get this:
'write
Open "c:\file.txt" For Output As #1
    Print #1, "hello2"
Close #1
'read
Open "c:\file.txt" For Input As #1
    Do While Not EOF(1)
        Line Input #1, Data
        Text1.Text = Data
    Loop
Close #1

That works.
Booooze is offline   Reply With Quote
Old May 4th, 2006, 7:53 PM   #8
RAzR Creations
Programmer
 
RAzR Creations's Avatar
 
Join Date: Apr 2006
Location: orange park Fl
Posts: 53
Rep Power: 3 RAzR Creations is on a distinguished road
what is the code to hide the program to the taskbar
RAzR Creations is offline   Reply With Quote
Old May 4th, 2006, 8:21 PM   #9
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Check your other post, and perhaps PM a mod to delete the other one.(looks like you created it twice)
Booooze is offline   Reply With Quote
Old May 4th, 2006, 8:40 PM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
what is the code to hide the program to the taskbar
What does that mean?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC