Register for your free account! | Forgot your password?

You last visited: Today at 18:12

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# Problem

Discussion on C# Problem within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1


 
elite*gold: 145
The Black Market: 293/0/0
Join Date: May 2014
Posts: 5,414
Received Thanks: 963
C# Problem

Habe ein Problem ich möchte ein Pw speicherer machen also ich gebe da in drei Felder Zusatz( Internetseiten...) Benutzername und Passwort. Nun möchte ich, dass er durch Drücken des Buttons "Speichern" Er diese drei Felder speichert also in nen Ordner, der schon besteht. Und am besten in eine .txt datei speichert und nach dem speichern in die .txt Datei ____________________________ unter den Daten macht, damit man für eine andere Seite auch seine Daten speichern kann. Ich weiß, dass ichs mit Streamwriter machen muss aber was genau nicht.
Epvp User is offline  
Old 09/07/2014, 15:04   #2

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,479
Received Thanks: 3,318
Arrow C/C++ -> .NET Languages

#moved
snow is offline  
Old 09/07/2014, 15:07   #3

 
Syc's Avatar
 
elite*gold: 666
Join Date: Apr 2011
Posts: 5,810
Received Thanks: 2,418
Und was genau ist nun dein Problem?

Syc is offline  
Old 09/07/2014, 15:12   #4


 
elite*gold: 145
The Black Market: 293/0/0
Join Date: May 2014
Posts: 5,414
Received Thanks: 963
Ich verstehe den Sinn dahinter nicht.
Epvp User is offline  
Old 09/07/2014, 16:46   #5
 
Schlüsselbein's Avatar
 
elite*gold: 0
Join Date: Feb 2013
Posts: 1,137
Received Thanks: 869
Hinter was?
Schlüsselbein is offline  
Old 09/07/2014, 16:48   #6
 
Warnuk3r's Avatar
 
elite*gold: 307
Join Date: Jul 2009
Posts: 1,091
Received Thanks: 434
Gibt doch 100 Beispiele wie man etwas in eine Datei schreibt, das kannst du sogar kopieren und fertig....
Warnuk3r is offline  
Old 09/07/2014, 21:18   #7
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
System.IO.File bietet komplett fertige methoden wo das mit den streams schon gemanaged ist
YatoDev is offline  
Old 09/08/2014, 21:28   #8
 
elite*gold: 0
Join Date: Nov 2007
Posts: 62
Received Thanks: 17
Simple example with a console program. Now it's up to you to customize it within WinForms.

Code:
using System.IO;
using System.Text;

namespace Password
{
    public class Account
    {
        public string Password { get; set; }
        public string Url { get; set; }
        public string Username { get; set; }
    }

    internal static class Program
    {
        private static void SaveAccount(Account account)
        {
            using (var writer = new StreamWriter(@"D:\Temp\Accounts.txt", true, new UTF8Encoding()))
            {
                writer.WriteLine(account.Url);
                writer.WriteLine(account.Username);
                writer.WriteLine(account.Password);

                for (int i = 0; i < account.Url.Length; i++) 
                    writer.Write("-");

                writer.WriteLine();
            }
        }

        private static void Main()
        {
            var account = new Account
            {
                Url = "http://www.myurl.com/test/",
                Username = "JohnDoe",
                Password = "1234567"
            };

            SaveAccount(account);
        }
    }
}
Demon-777 is offline  
Reply




All times are GMT +1. The time now is 18:12.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.