CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Location
    bangalore
    Posts
    26

    appending data into a file.

    suppose i have 2 different forms. if i click a button in first for i will get second form ,and now i have to generate a file which contains data of both the forms. so i need to append the data.
    how to do it.pls help me.
    srinivas

  2. #2
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569
    what do you mean "a file which contains data of both the forms"? An INI? A Frm? please be more specific.
    Mike

  3. #3
    Join Date
    Jan 2001
    Location
    India
    Posts
    228
    i guess u would like to write to a text file.

    where have u stored data in your form ?

    whereever it may be, u can refer controls of one form from another by refereing as formname.controlname

    suppose if u have some content in in a textbox in form1 and u wanna access it form2, u can access it as form1.text1.text

    be more specific if this is not what u required!
    regards
    madhu

  4. #4
    Join Date
    Jun 2003
    Location
    greece
    Posts
    5
    You need to declare public variables and every time you need to switch to the other form, just set the appropriate values to your variables.

    i.e.
    you have a textbox in your first form (txtName).
    you declare a public variable "varName"
    you write there "My name"
    Now you need to press the button that sends you to your second form.
    In the button s "click" event write the following code
    "varName = txtName.text"

    so, when you will be in the second form the value "My name" is stored in the variable "varName".

    Do the same for all the data you need from your first form
    klain main froilain...

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

Featured