Results 1 to 5 of 5

Thread: how to store two text box value to single text file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2011
    Posts
    25

    how to store two text box value to single text file

    Hello i m jst a new bee in coding so i need a lil bit favour of urs ... all i want to do is i need to store two text box value to single text file!!!sry if the thread post earliar in the forum!!!i hav checked other soluttions bt can't figure out wats goin wrong with this code ... thanks in advance



    Dim a As New FileSystemObject, data As TextStream
    Dim text As String
    Dim text1 As TextBox
    text = txtMsg.Text
    data = a.CreateTextFile("C:\test.txt")
    data.WriteLine(text)

    n i got error like dis


    """Object reference not set to an instance of an object.""""


    this is wat i m getting although it's not an error it's a warnig message but program terminates after this message .. n i'm trying 2 sort out d problem i want 2 ask u quetion that is it possible because i'm writing

    data.WriteLine(text)

    multiple times in more than one text boxes???? n is it possible to store more than one data in the txt file???
    for an example i want 2 store phone number, message , time like this
    90XXXXXXXX,hello, time
    90XXXXXXXX,hi, time

    eagerly waiting for ur reply

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    24

    Re: how to store two text box value to single text file

    Here you go!

    vb Code:
    1. Private Sub Write_Click()
    2. Dim sFileText As String
    3. Dim iFileNo As Integer
    4. iFileNo = FreeFile
    5. 'open the file for writing
    6. Open "C:\Test.txt" For Output As #iFileNo
    7.  
    8. Print #iFileNo, nnbox.Text & "," & " " & nbox.Text & "," & " " & mbox.Text
    9.  
    10. Close #iFileNo
    11.  
    12. End Sub
    Last edited by Mr.Nemo; Mar 11th, 2011 at 05:43 AM.

  3. #3
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: how to store two text box value to single text file

    To help make your code easier for others to read please wrap it in [highlight="vb"][/highlight] tags.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2011
    Posts
    25

    Re: how to store two text box value to single text file

    thank you sir but i m still getting errors ..... i dn't know the code u gave is for vb.net or vb6 .... i am using vb.net hope this makes u 2 understand my problem thank you ... here with i m uploading two images ....1st image test.rar was my today's invention and 2nd file recently created is ur suggestion mr nemo ....
    Attached Files Attached Files

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: how to store two text box value to single text file

    Quote Originally Posted by hardygandhi View Post
    i dn't know the code u gave is for vb.net or vb6 .... i am using vb.net
    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width