ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] [VB2010] txt ²©ö Ū ¼g µøµ¡

[¤À¨É] [VB2010] txt ²©ö Ū ¼g µøµ¡

¹w³]¥Ø¿ý¡GD:\123.txt
001.jpg
2013-3-7 13:44

¦³°ÝÃD¥i¥H°Ý...
¦¹©«¶È´£¨Ñ°ò¥»Åª¼g¥\¯à¡A¨ÃµL´£¨ÑÃöÁä¦r·j´M¥\¯à
  1. Imports System.IO
  2. '¤èªk1
  3. Public Class Form1
  4.     Dim lab As New Label
  5.     Dim bum1, bum2 As New Button
  6.     Dim te1, te2 As New TextBox
  7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         With Me
  9.             .Controls.Add(lab)
  10.             .Height = 600
  11.             .Width = 800
  12.             .FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
  13.             With .Controls
  14.                 .Add(te1) : .Add(te2) : .Add(bum1) : .Add(bum2)
  15.             End With
  16.         End With
  17.         With te1
  18.             .ScrollBars = ScrollBars.Both
  19.             .BorderStyle = BorderStyle.Fixed3D
  20.             .Width = (Me.Width - 40) / 2
  21.             .Height = Me.Height - 150
  22.             .Location = New Point(10, 100)
  23.             .Multiline = True
  24.         End With

  25.         With te2
  26.             .ScrollBars = ScrollBars.Both
  27.             .BorderStyle = BorderStyle.Fixed3D
  28.             .Width = (Me.Width - 40) / 2
  29.             .Height = Me.Height - 150
  30.             .Location = New Point(10 + te1.Width + te1.Location.X, 100)
  31.             .Multiline = True
  32.         End With
  33.         With bum1
  34.             .TextAlign = ContentAlignment.MiddleCenter
  35.             .Text = "¼g"
  36.             .Width = 100
  37.             .Height = 40
  38.             .Location = New Point(((te1.Location.X + te1.Width) / 2) - 50, 50)
  39.         End With

  40.         With bum2
  41.             .TextAlign = ContentAlignment.MiddleCenter
  42.             .Text = "Ū"
  43.             .Width = 100
  44.             .Height = 40
  45.             .Location = New Point((Me.Width - te2.Location.X - 10) + ((te2.Width + te2.Location.X) / 4), 50)
  46.         End With

  47.         With lab
  48.             .TextAlign = ContentAlignment.MiddleCenter
  49.             .Location = New Point((Me.Width / 2) - 100, 10)
  50.             .Width = 200
  51.             .Height = 25
  52.             .AutoSize = False
  53.             .BackColor = Color.Peru
  54.             .BorderStyle = BorderStyle.Fixed3D
  55.             .Text = "¥ý¼g«áŪ"
  56.         End With

  57.         AddHandler bum1.Click, AddressOf button1_Click
  58.         AddHandler bum2.Click, AddressOf button2_Click


  59.     End Sub

  60.     Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
  61.         Dim kk1 As String
  62.         kk1 = te1.Text

  63.         Dim FileNum As Integer
  64.         Dim strTemp As String

  65.         FileNum = FreeFile()
  66.         FileOpen(FileNum, "D:\123.txt", OpenMode.Output)

  67.         strTemp = kk1
  68.         PrintLine(FileNum, strTemp)

  69.         FileClose(FileNum)


  70.     End Sub
  71.     Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
  72.         Dim FileNum As Integer
  73.         Dim strTemp As String

  74.         FileNum = FreeFile()
  75.         FileOpen(FileNum, "D:\123.txt", OpenMode.Input)

  76.         Do Until EOF(FileNum)
  77.             te2.Text = LineInput(FileNum) & vbNewLine
  78.         Loop

  79.         FileClose(FileNum)
  80.     End Sub

  81. End Class
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

        ÀR«ä¦Û¦b : ¤£­n¤p¬Ý¦Û¤v¡A¦]¬°¤H¦³µL­­ªº¥i¯à¡C
ªð¦^¦Cªí ¤W¤@¥DÃD