daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Jan 11th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void btnSalvar_Click_1(object sender, EventArgs e)
  2.     {
  3.         ambiente();
  4.         cadastroTP();
  5.  
  6.  
  7.         StreamWriter sw = File.AppendText("c:\form\registro " + DateTime.Now.ToString("dd"+"-"+"MM"+"-"+"yyyy") + ".txt");
  8.  
  9.  
  10.         string dia = DateTime.Now.Day.ToString();
  11.         string mes = DateTime.Now.Month.ToString();
  12.         string ano = DateTime.Now.Year.ToString();
  13.         string hora = DateTime.Now.ToString("H:mm");
  14.  
  15.         String esp = "--------------------------------------------------------rn";
  16.  
  17.         tpv = "N° TP:  " + txbTp.Text + "rn";
  18.  
  19.         sw.WriteLine(cnpjv);
  20.         sw.WriteLine(nomev);
  21.         sw.WriteLine(canalv);
  22.         sw.WriteLine(portalv);
  23.         sw.WriteLine(empv);
  24.         sw.WriteLine(emailv);
  25.         sw.WriteLine(telv);
  26.         sw.WriteLine(detv);
  27.         sw.WriteLine(tpv);
  28.         sw.WriteLine("==> " + dia + "/" + mes + "/" + ano + " - " + hora);
  29.         sw.WriteLine(esp);
  30.         sw.WriteLine("Numero do portal:" + portalweb);
  31.  
  32.         sw.Close();
  33.  
  34.     }
  35.    
  36. private void button1_Click_1(object sender, EventArgs e)
  37.     {
  38.  
  39.         if (File.Exists("c:\form\registro " + DateTime.Now.ToString("dd" + "-" + "MM" + "-" + "yyyy") + ".txt"))
  40.         {
  41.             String varPalavra = txbTp.Text;
  42.  
  43.             StreamReader re = File.OpenText(@"c:\form\registro " + DateTime.Now.ToString("dd" + "-" + "MM" + "-" + "yyyy") + ".txt");
  44.             string input = re.ReadToEnd();
  45.  
  46.             if (input.IndexOf(varPalavra) > -1)
  47.  
  48.  
  49.                 MessageBox.Show("Existe a palavra '" + varPalavra + "' no arquivo txt");
  50.             else
  51.                 MessageBox.Show("Não existe a palavra '" + varPalavra + "' no arquivo txt");
  52.  
  53.             re.Close();
  54.         }
  55.         else
  56.         {
  57.             MessageBox.Show("O arquivo registro atual não existe!");
  58.         }
  59.  
  60.  
  61.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top