ok i've got this code
Dim sText As String = InputBox("Enter some text")
If String.Empty.Equals(sText) then return
If sText.length <= 0 Then Return
Dim oTW As IO.TextWriter
Try
oTW = New IO.StreamWriter("c:\text.txt")
oTW.WriteLine(s)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
If oTW isnot Nothing then
oTW.Flush()
oTW.Close()
End If
oTW = Nothing
End Try
This shouls save my input to a text file.
it's making the file alright but the text isn't getting saved
also i've got and error around the "If oTW isnot Nothing then" bit.
can somebody sort out my code 4 me plz![]()

code prob
Lrose
JD-SSan
oTW.WriteLine(sText.text)
Maybe
Adamus Turner
Healey6
ok but that doesn't fix the code error
look at this line of code
If oTW Isnon Nothing Thenit shows an error but i want to know how to fix it
System Error
Well lets see...
Would it be your preference for us to guess what the error is. Is it to be a secret
Col, chronically you don't give us enough information which inevitably is going to mean that you won't get much information back.
The correct syntax is "isnot nothing."
Larry Tenny
We can't give you any better information than you give us.
I recommend that you read the announcement at the top of the page.
Adrian Johnson
You still haven't posted the error message. By posting that it can help get to the root of the porblem alot quicker.
IRL11
hi,
i guess you can change it to something like that
If not oTW = Nothing Then
aslo you can do it this way
Dim sText As String = InputBox("Enter some text")
If String.Empty.Equals(sText) Then Return If sText.Length <= 0 Then Return Try 'using will open the file and dispose it when you finish using it Using otw As IO.TextWriter = New IO.StreamWriter("c:\text.txt")
otw.WriteLine(sText) 'stext not s because you didn't declair any s variable End Using Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
hope this helps
seanu
Dim sText As String = InputBox("Enter some text")
If String.Empty.Equals(sText) Then Return
If sText.Length <= 0 Then Return
Dim oTW As IO.TextWriter
Try
oTW = New IO.StreamWriter("c:\text.txt")
oTW.WriteLine(sText)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
If oTW IsNot Nothing Then
oTW.Flush()
oTW.Close()
End If
oTW = Nothing
End Try
NEC MultiSync90GX2
oTW.WriteLine(s)
Where is s defined and what's in it
My guess is that it is null.
SteveZ
ok if you look above you can see a load of code.
that should save text that i put in an inputbox yes.
but i have a error on the bit where it says
If oTW Is Not Nothing Thenit says
"is" requires operands that have reference type but, this operand has the value type `interger.
how do i fix this
Venu Sridhar
SarasMax
ok but now it says
"expected end of statement
for the NotNothing bit
cos75
either way, i don't work
MarkZ
What errors are you getting Is an exception thrown