I want to click a button and TextBox1 show the content of the file "1.txt"
but failed why??
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
FileOpen(1, "c:\1.txt", OpenMode.Binary)
FileGet(1, TextBox1.Text)
FileClose()
'TextBox1.Update()
'TextBox1.Refresh()
Dim mylen As Integer
mylen = TextBox1.TextLength() ' mylen is 0,,,,really strange I
think mylen = len of "1.txt"
End Sub 2 2001
On Apr 16, 8:00 am, "zhang" <makefrie...@163.comwrote:
I want to click a button and TextBox1 show the content of the file "1.txt"
but failed why??
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
FileOpen(1, "c:\1.txt", OpenMode.Binary)
FileGet(1, TextBox1.Text)
FileClose()
'TextBox1.Update()
'TextBox1.Refresh()
Dim mylen As Integer
mylen = TextBox1.TextLength() ' mylen is 0,,,,really strange I
think mylen = len of "1.txt"
End Sub
Zhang,
To read a textfile you must use StreamReader class.
See definition and samples on MSDN: http://msdn2.microsoft.com/en-us/lib...eamreader.aspx
Hope this helps,
Onur
A much simpler code that does work is the following:
Dim mylen As Integer
TextBox1.Text = System.IO.File.ReadAllText("c:\1.txt")
mylen = TextBox1.TextLength ' returns correct information
"zhang" wrote:
I want to click a button and TextBox1 show the content of the file "1.txt"
but failed why??
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
FileOpen(1, "c:\1.txt", OpenMode.Binary)
FileGet(1, TextBox1.Text)
FileClose()
'TextBox1.Update()
'TextBox1.Refresh()
Dim mylen As Integer
mylen = TextBox1.TextLength() ' mylen is 0,,,,really strange I
think mylen = len of "1.txt"
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: greenflame |
last post by:
I have been working for some time on a script that will show a matrix
with the elements aligned on the right for sometime and finally got it
to work. Then I did some patching up and ran the script...
|
by: Georg Scholz |
last post by:
Hello,
The class "Control" contains a documented Property "ControlType".
So for example, in a form, you can write code like this:
Dim c as control
set c = me.Controls("textbox1")
if...
|
by: Charts |
last post by:
I have a C# console application and I need pop up a Messagebox. However the
IntelliSense
does not show for using System.Windows.Forms; So, the application does not
recognize the MessageBox. Please...
|
by: Tsair |
last post by:
I create a custom DataGridViewColumn from a usercontrol with Textbox and a
button. After input the usercontrol textbox value and press Tab to next
column, the value of the textbox does not show in...
|
by: D Witherspoon |
last post by:
What is happening is that I have a class (ClassA) that inherits a class
(ClassB) which inherits System.Net.Mail.MailMessage
Project 1 references Project 2,
Project 2 references Project 3.
...
|
by: active |
last post by:
I have two asp:Table
One (Table2) inside a tablecell of the other (Table1)
Only one (Table1) shows up in the properties list in Design mode.
I have cells in Table2 and they show in the view...
|
by: Claes Wedin |
last post by:
I have problems using DataGridViewImageColulmn:
The Image does not show (only a red X is shown).
I tried this:
- Create New WindowsForms app
- In the Form: Drag a DataGridView control to the...
|
by: Hetal |
last post by:
We recently upgraded to VS 2008 and for some reason, the environment
does not show "Start Page" in full screen mode even when setting in
Environment -Startup is set to "Show Start Page". It does...
|
by: ATS |
last post by:
Hi,
I, and some collegues of mine, are running into a weird problem with
Access 2003. If I want to define a new query (or want to add a table
or query to an existing query), Access shows a...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |