update textbox text?

Getox

Well-known member
Joined
Jul 8, 2004
Messages
122
i want to set the textbox text to what is in a file
so far i have

Code:
        Dim oFile As System.IO.File
        Dim oRead As System.IO.StreamReader
        oRead = oFile.OpenText("settings.ini")
        Me.homepage.Text(oRead)
but "Me.homepage.Text(oRead)" is wrong, can anyone help?
 
well all that is in settings.ini is just a url to a site
Settings.ini:
Code:
http://www.trelio.com/

all i want to do is just make the text box show the contents of the settings.ini file
 
well i tried a diff way but it still dont work
Code:
        Dim oFile As System.IO.File
        Dim oRead As System.IO.StreamReader
        oRead = oFile.OpenText("settings.ini")
        homepage.AppendText(oRead)
        oRead.Close()
"Form4.vb(86): Value of type System.IO.StreamReader cannot be converted to String."
that line is "homepage.AppendText(oRead)"
 
Did you try Mutants suggestion? You cannot simply use a StreamReader instead of a string - you need to call one of its Methods to read from the file. Assuming homepage is a textbox try
Code:
        Dim oFile As System.IO.File
        Dim oRead As System.IO.StreamReader
        oRead = oFile.OpenText("settings.ini")
        homepage..Text= oRead.ReadToEnd()
        oRead.Close()
 
PlausiblyDamp said:
Did you try Mutants suggestion? You cannot simply use a StreamReader instead of a string - you need to call one of its Methods to read from the file. Assuming homepage is a textbox try
Code:
        Dim oFile As System.IO.File
        Dim oRead As System.IO.StreamReader
        oRead = oFile.OpenText("settings.ini")
        homepage..Text= oRead.ReadToEnd()
        oRead.Close()
Hey thanks that got it working :)
how would i make it just read the top line? or XX line ?
 
Did you even consider cheking MSDN or even the tooltips (or possibly the error message)? ReadLine doesnt take any parameters - it simply reads the next line from the file.
Code:
homepage..Text= oRead.ReadLine()
 
Back
Top