![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Jan 2008
Posts: 53
Rep Power: 1
![]() |
I am trying to output a number that is entered into a textbox called adminsundaycpaTextBox.Text. This number is supposed to be entered into a text file called Sundaypm.Text
I had absolutely no idea how to use visual basic 1 month ago, and now I am trying to learn. So here is my code. for the output statement. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Open the file for output. FileOpen(1, "Sundaypm.txt", OpenMode.Output) ' Close before reopening in another mode. ' Calculate Checkpoint A situation. adminsundaycpaTextBox.Text = adminsundaycpaTextBox.Text Write(1) FileClose(1) Me.Close() End Sub There was not much help online, because most was for older versions of visual basic. I learned this much using the index feature in visual basic. Thank you for your replys. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: What is wrong with this Output Statement
adminsundaycpaTextBox.Text = adminsundaycpaTextBox.Text That piece of code there does absolutely zip. Nadda. You are telling it to reassign its value to itself. In other words, x = x.You don't seem to be using the right code for writing files. At least according to this thread. You might want to use the second example ("An example of writing a file"). Edit: Oh, you're using a newer version of VB that doesn't support this? Hmph. Try Write(adminsundaycpaTextBox.Text). |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jan 2008
Posts: 53
Rep Power: 1
![]() |
Edit: Oh, you're using a newer version of VB that doesn't support this? Hmph.
Try Write(adminsundaycpaTextBox.Text).[/quote] I figured it out, but now I am having a trouble reading from the file and storing the result in a variable so that I can compare it to another. Any ideas on how to read one number from a file and store it into a variable? Thank you for your reply, I am using a different computer otherwise I would share the solution code that I used. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is Wrong with this If Statement? Please Help. | kewlgeye | Visual Basic | 4 | Jul 21st, 2008 9:03 AM |
| Change the name of output file | jazz | C | 4 | Jun 28th, 2006 2:54 AM |
| What is wrong with this code? | c0ldshadow | Visual Basic .NET | 5 | Dec 5th, 2005 5:37 PM |
| It's giving me "Press any key to continue" and no other output.. | Insomniac | C | 15 | Jun 5th, 2005 7:07 AM |
| Can someone help me with my output | hopeolicious | C++ | 0 | Feb 28th, 2005 4:47 PM |