Jump to content
Endakin

vb.net SaveFileDialog

Recommended Posts

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 Sub

am testat si merge ok

Edited by DrGrim
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...