Endakin Posted June 6, 2012 Report Share Posted June 6, 2012 Incerc sa invat vb.net. Cum fac sa salvez textul dintr-un textbox intr-un fisier .txt (de preferat in acelasi folder cu executabilul)? Quote Link to comment Share on other sites More sharing options...
M2G Posted June 6, 2012 Report Share Posted June 6, 2012 Visual Basic .NET programming for Beginners - How to Write to a Text FileGreu, greu cu programarea asta...Primul rezultat de pe google. Quote Link to comment Share on other sites More sharing options...
DrGrim Posted June 6, 2012 Report Share Posted June 6, 2012 (edited) fa asa daca nu este suficienta documentatia data de M2G Dim v As New SaveFileDialog() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click v.Title = "Titlu" v.InitialDirectory = Application.StartupPath v.AddExtension = True v.Filter = "TXT (*.txt)|*.txt" Dim p As String = TextBox1.Text Dim lDialogResult As DialogResult = v.ShowDialog() If lDialogResult = Windows.Forms.DialogResult.OK Then My.Computer.FileSystem.WriteAllText(v.FileName, TextBox1.Text, True) 'sau System.IO.File.WriteAllText(v.FileName, TextBox1.Text) End If End Subam testat si merge ok Edited June 6, 2012 by DrGrim Quote Link to comment Share on other sites More sharing options...
SilviuSDS Posted June 7, 2012 Report Share Posted June 7, 2012 SaveFileDialog este doar fereastra in care userul alege folderul in care vrea sa salveze fisierul si numele acestuia, pe care le returneaza sub forma unui string pe care il folosesti ca un fel de adresa in care scrii textul, nu creeaza fisierul direct cu textul in el. Codul scris de DrGrim e ok, face ceea ce trebuie, sper sa inveti din el. Quote Link to comment Share on other sites More sharing options...