5 Replies - 2094 Views - Last Post: 16 February 2010 - 05:45 AM Rate Topic: -----

#1 Guest_Deeps*


Reputation:

Text Box value to store in a file and read back to text file

Posted 11 February 2010 - 08:24 AM

Hi,


I have a Username,IpAddress and port which needs to be saved to the txt file and when the user logs in again i need to read form the txt file and show the values in the text file in form_load itself so that user don't have to enter again.This file should be cleaned every time when the user successfully logs in and should be shown next time when user logs in.


Please help.

Regards,
Is This A Good Question/Topic? 0

Replies To: Text Box value to store in a file and read back to text file

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Text Box value to store in a file and read back to text file

Posted 11 February 2010 - 08:29 AM

OK, so the next step is for you to show us the code you have and the problems you are having exactly. Post the exact errors if you're receiving any.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Deeps*


Reputation:

Re: Text Box value to store in a file and read back to text file

Posted 12 February 2010 - 01:31 AM

i need to write the code for this.
But i need some logic to start off.
We can also store this details into a Excelsheet.
But how to implement this.
Was This Post Helpful? 0

#4 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Text Box value to store in a file and read back to text file

Posted 12 February 2010 - 06:47 AM

1. On form load, open the text file (if it exists), read the data, and populate the UI elements with the desired data.
2. User logs in successfully:
Save text file in overwrite mode to known location.
Was This Post Helpful? 0
  • +
  • -

#5 zdavis   User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 37
  • Joined: 12-February 10

Re: Text Box value to store in a file and read back to text file

Posted 12 February 2010 - 07:23 AM

Deeps,

If you are reading from a text file you can use something like a TextReader or StreamReader to read the file. Just like JackOfAllTrades suggested you need to make sure the file exists. This can be done by using the File.Exists() class/method in the System.IO namespace. Below I have put a link to the StreamReader MSDN page.

StreamReader

http://msdn.microsof...reamreader.aspx

See how you get along trying this and post when/if you get stuck.

Hope this helps,

-zd
Was This Post Helpful? 0
  • +
  • -

#6 Guest_Deeps*


Reputation:

Re: Text Box value to store in a file and read back to text file

Posted 16 February 2010 - 05:45 AM

Thanks for the response.i Think i didn't put the requirement properly.Let me put it this way.

I am working on Excel Addin(2003).i use visual studio for office(VSTO) which has a Login form that has
some text box.Once after the successful login Excel sheet will get open.this is the complete login scenario.

Required thing:-

There are several text boxes in the loginScreen and i need to store the values of the text box to the excel sheet ,i mean in the same addin but in the different sheet which should be hidden. and also when i relogin i need to store values back to this correspoding textboxes from the excel sheet as we have stored
Was This Post Helpful? 0

Page 1 of 1