|
-
Jul 8th, 2010, 12:56 PM
#1
Thread Starter
Lively Member
[RESOLVED] Open/Saving textbox values
hey guys...My windows form as a bunch of textboxes on it that basically let the user put in different positions/forces that a test cycle then uses. I am trying to let the user save their profile settings/open the settings so they don't have to input the same values every time they want to run the same test. Here is my code so far. basically, when i save my csv file, and open it, all 6 textbox values are plopped in the first textbox instead of being distributed to their original boxes. I just read about a "split" function that I am going to read up on and see if that will help, but in the meantime, PLEASE HELP! Keep in mind i am a beginner and this is my first exposure with the save/openfileDialog classes...Thanks guys. I know you'll help out.
code Code:
Private Sub SaveProfileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveProfileToolStripMenuItem.Click
SaveProfileDialog.ShowDialog()
Dim sw As StreamWriter
Try
With SaveProfileDialog
.FileName = FileName
.Filter = "CSV files (*.csv)|*.csv|" & "All files|*.*"
If .ShowDialog() = DialogResult.OK Then
FileName = .FileName
sw = New StreamWriter(FileName)
sw.Write(Position1.Text)
sw.Write(Position2.Text)
sw.Write(Position3.Text)
sw.Write(Position4.Text)
sw.Write(Position5.Text)
sw.Write(Position6.Text)
End If
End With
Catch es As Exception
MessageBox.Show(es.Message)
Finally
If Not (sw Is Nothing) Then
sw.Close()
End If
End Try
End Sub
Private Sub OpenProfileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenProfileToolStripMenuItem.Click
Dim sr As StreamReader
Try
With OpenProfileDialog
.Filter = "CSV files (*.csv)|*.csv|" & "All files|*.*"
If .ShowDialog() = DialogResult.OK Then
FileName = .FileName
sr = New StreamReader(.OpenFile)
Position1.Text = sr.Read
End If
End With
Catch es As Exception
MessageBox.Show(es.Message)
Finally
If Not (sr Is Nothing) Then
sr.Close()
End If
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|