Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
Windows Forms
Help With StreamWriter
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="pointl3ss69, post: 118714, member: 28296"] ' Form 1 [CODE]Imports System.IO Public Class Form1 Dim ab As String Dim DesktopLocation1 As String = System.Environment.SpecialFolder.Desktop Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle Me.Width = Screen.PrimaryScreen.Bounds.Width Me.Height = Screen.PrimaryScreen.Bounds.Height - 30 Me.WebBrowser1.Height = Me.Height Module1.load() End Sub Private Sub ButtonBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonBrowse.Click OpenFileDialog1.Filter = "jpg (*.jpg) |*.jpg;*.jpeg" If OpenFileDialog1.ShowDialog() = DialogResult.OK Then PictureBox1.ImageLocation = OpenFileDialog1.FileName MsgBox("The wallpaper has been changed") Module1.save() End If End Sub Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click If Panel1.Visible = True Then Panel1.Visible = False Else : Panel1.Visible = True End If End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate(DesktopLocation1) WebBrowser1.Visible = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize Then PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage Label1.Text = "Center Image" ElseIf PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage Then PictureBox1.SizeMode = PictureBoxSizeMode.Normal Label1.Text = "Normal" ElseIf PictureBox1.SizeMode = PictureBoxSizeMode.Normal Then PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage Label1.Text = "Stretch Image" ElseIf PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage Then PictureBox1.SizeMode = PictureBoxSizeMode.Zoom Label1.Text = "Zoom" Else PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize Label1.Text = "Auto Size" End If Module1.save() End Sub Private Sub ButtonLocation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLocation.Click If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then DesktopLocation1 = FolderBrowserDialog1.SelectedPath MsgBox(DesktopLocation1) WebBrowser1.Navigate(DesktopLocation1) Module1.save() End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click WebBrowser1.Visible = False End Sub End Class[/CODE] ' Module 1 [CODE]Imports System.IO Module Module1 Dim FILE_NAform1 As String = (System.Environment.CurrentDirectory + "\data.txt") Sub save() Dim objWriter1 As New StreamWriter(FILE_NAform1) objWriter1.WriteLine(Form1.PictureBox1.ImageLocation) objWriter1.WriteLine(Form1.FolderBrowserDialog1.SelectedPath) objWriter1.WriteLine(Form1.PictureBox1.SizeMode) objWriter1.Close() End Sub Sub load() Try Dim ary(2) As String Dim I As Integer = 0 Dim objReader As New StreamReader(FILE_NAform1) Do Until objReader.EndOfStream ary(I) = objReader.ReadLine I = I + 1 Loop Form1.PictureBox1.ImageLocation = ary(0) Form1.FolderBrowserDialog1.SelectedPath = ary(1) Form1.PictureBox1.SizeMode = ary(2) objReader.Close() Catch ex As Exception MsgBox("No Saved Data Found.") Form1.WebBrowser1.Navigate(System.Environment.SpecialFolder.Desktop) End Try Form1.Label1.Text = "Alignment" End Sub End Module[/CODE] give this one a shot, let me know how it goes. :D [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
Windows Forms
Help With StreamWriter
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom