View Single Post
Join Date: Dec 2008
Posts: 9
Reputation: Evil03 is an unknown quantity at this point 
Solved Threads: 0
Evil03 Evil03 is offline Offline
Newbie Poster

Re: Export Data to Notepad

 
0
  #9
Jan 6th, 2009
Originally Posted by Comatose View Post
This Site will help you out a great deal. The best way to do this is something like:
  1. Dim oFile as System.IO.File
  2. Dim oWrite as System.IO.StreamWriter
  3. oWrite = oFile.CreateText(“C:\sample.txt)
  4. oWrite.WriteLine({0,10}{1,10}{2,25}”, “Date”, “Time”, “Price”)
  5. oWrite.WriteLine({0,10:dd MMMM}{0,10:hh:mm tt}{1,25:C}”, Now(), 13455.33)
  6. oWrite.Close()
Here, if you mess with the numbers that are inside the {}, you can adjust exactly where in the text file you want the data to go....If this solution doesn't work (but it should) we can try one more (ugly) way.

Hi Guys Thanks for sharing Valuable information.
With ur Precious Help & time , my problem is HALF SOLVED


My Project will be completed if i can overcome this problem through valuable help from u guys.

Below is the coding:
***************************************************

Private Sub btnnotepad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnotepad.Click

Dim filename As String = "C:\Documents and Settings\Acer\Desktop\CounsellingSystem\Counsellrecords.txt"

Dim objwriter As New System.IO.StreamWriter(filename, True)

objwriter.WriteLine("{0,5}{1,30}{2,15}{3,15}{4,15}{5,15}", txtname.Text, txtnpos.Text, txtcname.Text, txtcpos.Text, DateTimePickerdoc.Value.ToShortDateString, DateTimePickerrd.Value.ToShortDateString)

objwriter.Close()

MsgBox("Record Saved To Notepad")

End sub

******************************************************

Please See attachment
Attached Files
File Type: txt Counsellrecords.txt (1.1 KB, 6 views)
Reply With Quote