Private Sub DataGridView1_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim index As Integer
index = e.RowIndex
Dim selectedRow As DataGridViewRow
selectedRow = DataGridView1.Rows(index)
TextBox1.Text = selectedRow.Cells(0).Value.ToString()
TextBox2.Text = selectedRow.Cells(1).Value.ToString()
TextBox3.Text = selectedRow.Cells(2).Value.ToString()
End Sub
Imports System.IO
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Save File In .txt (Notepad)
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text [*.txt*]|*.txt"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(TextBox1.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
System.IO.File.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SaveFileDialog1.Filter = "Word Documents|*.doc"
End Sub
End Class
Post a Comment