During create and write a text file which written in form load, the form is hang.

  • Thread starter Thread starter Hany Metry
  • Start date Start date
H

Hany Metry

Guest
Hi,

I have a problem (form hang) for the below code, which code written in form load.


Me.RichTextBox1.AppendText(Environment.NewLine & " Coordinates of reinforcement with respect to center of gravity of the shape")
Me.RichTextBox1.AppendText(Environment.NewLine & " Dia R-X-Coor R-Y-Coor")
Me.RichTextBox1.AppendText(Environment.NewLine & " No. mm mm mm")
For I = 0 To NumBarcoor - 1
Dim line As String
line = String.Format(format6, I + 1, Dia(I), coorx1(I), coory1(I))
Me.RichTextBox1.AppendText(Environment.NewLine & line)
Next
Me.RichTextBox1.AppendText(Environment.NewLine & " The above coordinates of reinforcement are not shown in the hard print while it can be")
Me.RichTextBox1.AppendText(Environment.NewLine & " shown in text file")
Dim file As System.IO.StreamWriter
If My.Settings.FileName1 = "" Then
file = My.Computer.FileSystem.OpenTextFileWriter("D:\Untitled.txt", True)
Else
file = My.Computer.FileSystem.OpenTextFileWriter("D:\" & My.Settings.FileName1 & ".txt", True)
End If
file.WriteLine(TV)
file.WriteLine(Str2007)
file.close()






And when I change the code to be


Me.RichTextBox1.AppendText(Environment.NewLine & " Coordinates of reinforcement with respect to center of gravity of the shape")
Me.RichTextBox1.AppendText(Environment.NewLine & " Dia R-X-Coor R-Y-Coor")
Me.RichTextBox1.AppendText(Environment.NewLine & " No. mm mm mm")
For I = 0 To NumBarcoor - 1
Dim line As String
line = String.Format(format6, I + 1, Dia(I), coorx1(I), coory1(I))
Me.RichTextBox1.AppendText(Environment.NewLine & line)
Next
Me.RichTextBox1.AppendText(Environment.NewLine & " The above coordinates of reinforcement are not shown in the hard print while it can be")
Me.RichTextBox1.AppendText(Environment.NewLine & " shown in text file")
Dim file As System.IO.StreamWriter
If My.Settings.FileName1 = "" Then
file = My.Computer.FileSystem.OpenTextFileWriter("D:\\Untitled.txt", True)
Else
file = My.Computer.FileSystem.OpenTextFileWriter("D:\\" & My.Settings.FileName1 & ".txt", True)
End If
file.WriteLine(TV)
file.WriteLine(Str2007)







I still have the same problem (form hang).

Kind Regards,



Hany Metry

Continue reading...
 
Back
Top