VB2005
This code is working but i have a few problem in sorting of existing file..
example.
Output:
i want the output look like this
the new date should be on the first line how can i code it?
This code is working but i have a few problem in sorting of existing file..
example.
Output:
4/21/2009 12:30:27 PM,1111111111111,11
4/21/2009 12:30:31 PM,2222222222222,22
4/21/2009 12:30:36 PM,3333333333333,33
4/21/2009 12:30:40 PM,4444444444444,44
i want the output look like this
the new date should be on the first line how can i code it?
4/21/2009 12:30:40 PM,4444444444444,44
4/21/2009 12:30:36 PM,3333333333333,33
4/21/2009 12:30:31 PM,2222222222222,22
4/21/2009 12:30:27 PM,1111111111111,11
VB.NET:
Imports System
Imports System.IO
Public Class Form3
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SaveData()
highlighttextbox1()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
highlighttextbox1()
End Sub
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
highlighttextbox1()
End Sub
Public Sub SaveData()
Dim stream_writer As New StreamWriter("\test.csv", True)
Dim D = Date.Now
stream_writer.WriteLine(D & "," & Val(TextBox1.Text) & "," & Val(TextBox2.Text))
stream_writer.Close()
End Sub
Public Sub highlighttextbox1()
TextBox1.SelectionStart = 0
TextBox1.SelectionLength = Len(TextBox1.Text)
TextBox1.Focus()
End Sub
Public Sub highlighttextbox2()
TextBox2.SelectionStart = 0
TextBox2.SelectionLength = Len(TextBox2.Text)
'TextBox2.Focus()
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then SendKeys.Send("{TAB}")
highlighttextbox2()
End Sub
Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
If e.KeyCode = Keys.Enter Then 'SendKeys.Send("{TAB}")
SaveData()
highlighttextbox1()
End If
End Sub
End Class
Last edited by a moderator: