473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

opening files and writing

how can i open a file i saved and place the info into different text boxes?
Nov 21 '05 #1
16 2176
Create a new Windows application, switch to code view & replace the existing
code with this:

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(512, 32)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Open"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(88, 16)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Filename:"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 32)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(480, 20)
Me.TextBox1.TabIndex = 2
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(16, 64)
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(568, 216)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(424, 296)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 4
Me.Button2.Text = "Clear"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(512, 296)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 5
Me.Button3.Text = "Exit"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(600, 333)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Dim strFilename As String
Dim sr As IO.StreamReader

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With OpenFileDialog1
.InitialDirectory =
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
.FilterIndex = 1
If .ShowDialog = DialogResult.OK Then
strFilename = .FileName
TextBox1.Text = strFilename
Else
Exit Sub
End If
End With

sr = New IO.StreamReader(strFilename)
TextBox2.Text = sr.ReadToEnd
sr.Close()
End Sub

Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.GotFocus
Button1.Focus()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = String.Empty
TextBox2.Text = String.Empty
strFilename = String.Empty
Button1.Focus()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
If Not sr Is Nothing Then sr.Close()
Application.Exit()
End Sub
End Class

---------------------------

I wrote this especially for you & I hope this helps
Nov 21 '05 #2
yea it helps but im sry for being a pain but im just trying to learn so i can
do this too eventuially but how wold i add opening to my original form
because i have almost everything done besides this and i can save all my
information to a text fle in notepad and i just would like to get the
inmformation from that file (its all on one like like abcd efg dfghj) and
have each segment go into a predetermined text box...sry again for being a
pain
Nov 21 '05 #3
Can you clarify because I am confused by what you want?

Create a new project from my code. Open your one up, add a OpenFileDialog
control, paste in my code to open the file up...

What is this ABC DEF GHI part? Do you want to split that line into 3 &
display it in 3 different text boxes? If so, are they multiline?

Awaiting your answer

"iwdu15" wrote:
yea it helps but im sry for being a pain but im just trying to learn so i can
do this too eventuially but how wold i add opening to my original form
because i have almost everything done besides this and i can save all my
information to a text fle in notepad and i just would like to get the
inmformation from that file (its all on one like like abcd efg dfghj) and
have each segment go into a predetermined text box...sry again for being a
pain

Nov 21 '05 #4
yea sry, im writing a code for a NCAA championship bracket and i have almost
everything done but the saving so what i want is to have someones picks for
each round in text boxes, and when they save the file, itl save everything in
a file and when they open the fiel for all the teams to be in the order they
put it, if that ehlps, if not i can just send u the program so u have an idea
on what i mean
Nov 21 '05 #5
I don't give out my e-mail because of SPAM, even though reversing/reporting
SPAM is a big hobby of mine

Just put evething in here
Nov 21 '05 #6
understandable, heres the saving code:
Dim strFilename As String
Dim userfilename As String
With SaveFileDialog1
.DefaultExt = "txt"
.Filter = "txt (*.txt)|*.txt|All Files (*.*)|*.*"
.FilterIndex = 0
.InitialDirectory = "C:\"
If .ShowDialog = DialogResult.OK Then
userfilename = .FileName
Else
Exit Sub
End If
End With
Dim fs As New FileStream("userfilename.txt", FileMode.Create,
FileAccess.Write)
Dim textfile As New StreamWriter(fs)
textfile.Write(Me.txtteameast1.Text)
textfile.Write(Me.txtteameast2.Text)
textfile.Write(Me.txtteameast10.Text)
textfile.Write(Me.txtteameast11.Text)
textfile.Write(Me.txtteameast12.Text)
textfile.Write(Me.txtteameast13.Text)
textfile.Write(Me.txtteameast14.Text)
textfile.Write(Me.txtteameast15.Text)
textfile.Write(Me.txtteameast16.Text)
textfile.Write(Me.txtteameast3.Text)
textfile.Write(Me.txtteameast4.Text)
textfile.Write(Me.txtteameast5.Text)
textfile.Write(Me.txtteameast6.Text)
textfile.Write(Me.txtteameast7.Text)
textfile.Write(Me.txtteameast8.Text)
textfile.Write(Me.txteameast9.Text)
textfile.Write(Me.BackgroundImage)
textfile.Close()
fs.Close()
so i want that when it saveseach of those text box's text, that when i open
the file it will go back into the correct text box
Nov 21 '05 #7
Ok. Now I understand. Give me a little while & I will post some code back,
but I will change your save code too

Nov 21 '05 #8
any luck?
Nov 21 '05 #9
I have coded this for you. It is written in EXTREMELY easy code so you can
understand it. I could remove the repetitious code, but I think you would get
lost & not understand it like that.

There is no error checking to keep to code to a minimum.
You will need to create the file first & add text to the textboxes, save it
or you will get an index out of bounds error. I suggest, you comment out the
line of code in FORM LOAD, which will enable the save buttons, type something
in all the textboxes & save it. Then uncomment the line of text in FORM LOAD
again to disable the buttons again.

As before: Create a new Windows application & replace ALL form code... with
this:
-----------------------------------------------------------------------------------------------

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
Friend WithEvents TextBox10 As System.Windows.Forms.TextBox
Friend WithEvents TextBox11 As System.Windows.Forms.TextBox
Friend WithEvents TextBox12 As System.Windows.Forms.TextBox
Friend WithEvents TextBox13 As System.Windows.Forms.TextBox
Friend WithEvents TextBox14 As System.Windows.Forms.TextBox
Friend WithEvents TextBox15 As System.Windows.Forms.TextBox
Friend WithEvents TextBox16 As System.Windows.Forms.TextBox
Friend WithEvents TextBox17 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.TextBox8 = New System.Windows.Forms.TextBox
Me.TextBox9 = New System.Windows.Forms.TextBox
Me.TextBox10 = New System.Windows.Forms.TextBox
Me.TextBox11 = New System.Windows.Forms.TextBox
Me.TextBox12 = New System.Windows.Forms.TextBox
Me.TextBox13 = New System.Windows.Forms.TextBox
Me.TextBox14 = New System.Windows.Forms.TextBox
Me.TextBox15 = New System.Windows.Forms.TextBox
Me.TextBox16 = New System.Windows.Forms.TextBox
Me.TextBox17 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.SystemColors.HighlightText
Me.TextBox1.Location = New System.Drawing.Point(16, 8)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.ReadOnly = True
Me.TextBox1.Size = New System.Drawing.Size(488, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(16, 40)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(232, 20)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(16, 72)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(232, 20)
Me.TextBox3.TabIndex = 2
Me.TextBox3.Text = ""
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(16, 104)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(232, 20)
Me.TextBox4.TabIndex = 3
Me.TextBox4.Text = ""
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(16, 136)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(232, 20)
Me.TextBox5.TabIndex = 4
Me.TextBox5.Text = ""
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(16, 168)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(232, 20)
Me.TextBox6.TabIndex = 5
Me.TextBox6.Text = ""
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(16, 200)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(232, 20)
Me.TextBox7.TabIndex = 6
Me.TextBox7.Text = ""
'
'TextBox8
'
Me.TextBox8.Location = New System.Drawing.Point(16, 232)
Me.TextBox8.Name = "TextBox8"
Me.TextBox8.Size = New System.Drawing.Size(232, 20)
Me.TextBox8.TabIndex = 7
Me.TextBox8.Text = ""
'
'TextBox9
'
Me.TextBox9.Location = New System.Drawing.Point(16, 264)
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.Size = New System.Drawing.Size(232, 20)
Me.TextBox9.TabIndex = 8
Me.TextBox9.Text = ""
'
'TextBox10
'
Me.TextBox10.Location = New System.Drawing.Point(272, 40)
Me.TextBox10.Name = "TextBox10"
Me.TextBox10.Size = New System.Drawing.Size(232, 20)
Me.TextBox10.TabIndex = 9
Me.TextBox10.Text = ""
'
'TextBox11
'
Me.TextBox11.Location = New System.Drawing.Point(272, 72)
Me.TextBox11.Name = "TextBox11"
Me.TextBox11.Size = New System.Drawing.Size(232, 20)
Me.TextBox11.TabIndex = 10
Me.TextBox11.Text = ""
'
'TextBox12
'
Me.TextBox12.Location = New System.Drawing.Point(272, 104)
Me.TextBox12.Name = "TextBox12"
Me.TextBox12.Size = New System.Drawing.Size(232, 20)
Me.TextBox12.TabIndex = 11
Me.TextBox12.Text = ""
'
'TextBox13
'
Me.TextBox13.Location = New System.Drawing.Point(272, 136)
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.Size = New System.Drawing.Size(232, 20)
Me.TextBox13.TabIndex = 12
Me.TextBox13.Text = ""
'
'TextBox14
'
Me.TextBox14.Location = New System.Drawing.Point(272, 168)
Me.TextBox14.Name = "TextBox14"
Me.TextBox14.Size = New System.Drawing.Size(232, 20)
Me.TextBox14.TabIndex = 13
Me.TextBox14.Text = ""
'
'TextBox15
'
Me.TextBox15.Location = New System.Drawing.Point(272, 200)
Me.TextBox15.Name = "TextBox15"
Me.TextBox15.Size = New System.Drawing.Size(232, 20)
Me.TextBox15.TabIndex = 14
Me.TextBox15.Text = ""
'
'TextBox16
'
Me.TextBox16.Location = New System.Drawing.Point(272, 232)
Me.TextBox16.Name = "TextBox16"
Me.TextBox16.Size = New System.Drawing.Size(232, 20)
Me.TextBox16.TabIndex = 15
Me.TextBox16.Text = ""
'
'TextBox17
'
Me.TextBox17.Location = New System.Drawing.Point(272, 264)
Me.TextBox17.Name = "TextBox17"
Me.TextBox17.Size = New System.Drawing.Size(232, 20)
Me.TextBox17.TabIndex = 16
Me.TextBox17.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(528, 8)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 17
Me.Button1.Text = "Open"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(528, 40)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 18
Me.Button2.Text = "Save"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(528, 72)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 19
Me.Button3.Text = "Clear"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(528, 104)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 20
Me.Button4.Text = "Exit"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(618, 303)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox17)
Me.Controls.Add(Me.TextBox16)
Me.Controls.Add(Me.TextBox15)
Me.Controls.Add(Me.TextBox14)
Me.Controls.Add(Me.TextBox13)
Me.Controls.Add(Me.TextBox12)
Me.Controls.Add(Me.TextBox11)
Me.Controls.Add(Me.TextBox10)
Me.Controls.Add(Me.TextBox9)
Me.Controls.Add(Me.TextBox8)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Open/Save Example By Crouchie1998"
Me.ResumeLayout(False)

End Sub

#End Region

#Region "Declarations"
' Variable used for filename
Dim strFilename As String
' Variable to hold the default save location
Dim strDefaultLocation As String =
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)
' Stream reader object
Dim sr As IO.StreamReader
' Stream writer object
Dim sw As IO.StreamWriter
#End Region

#Region "Open Button"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With OpenFileDialog1
' Open in Desktop directory
.InitialDirectory = strDefaultLocation
' Set up filters
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
' Select text files
.FilterIndex = 0
' Show dialog
If .ShowDialog = DialogResult.OK Then
' User pressed OK
' Pass the filename to the
' 'strFilename' variable
strFilename = .FileName()
' Show the file path in the textbox
TextBox1.Text = strFilename
Else
' User pressed cancel
Exit Sub
End If
End With
' Open the file chosen
' by the user
OpenFile(strFilename)
End Sub

#End Region

#Region "Open File (SUB)"

Private Sub OpenFile(ByVal sFilename As String)
' Create a new stream reader object
sr = New IO.StreamReader(sFilename)
' Variable to hold lines in the text file
Dim strLines() As String
' Variable to hold the file contents
Dim strLine As String
' Read the entire file (16 lines)
strLine = sr.ReadToEnd
' Seperate those lines
strLines = strLine.Split(ControlChars.CrLf)
' Pass those lines to the textboxes
TextBox2.Text = strLines(0).Trim
TextBox3.Text = strLines(1).Trim
TextBox4.Text = strLines(2).Trim
TextBox5.Text = strLines(3).Trim
TextBox6.Text = strLines(4).Trim
TextBox7.Text = strLines(5).Trim
TextBox8.Text = strLines(6).Trim
TextBox9.Text = strLines(7).Trim
TextBox10.Text = strLines(8).Trim
TextBox11.Text = strLines(9).Trim
TextBox12.Text = strLines(10).Trim
TextBox13.Text = strLines(11).Trim
TextBox14.Text = strLines(12).Trim
TextBox15.Text = strLines(13).Trim
TextBox16.Text = strLines(14).Trim
TextBox17.Text = strLines(15).Trim
' Close the stream reader
sr.Close()
' Destroy the stream reader object
sr = Nothing
' Enable the save & clear buttons, plus
' disable the open button
EnableDisableButtons(True)
End Sub

#End Region

#Region "Save Button"

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
' See open file dialog for info on this
With SaveFileDialog1
' Default extension to use
.DefaultExt = "txt"
.InitialDirectory = strDefaultLocation
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
.FilterIndex = 0
If .ShowDialog = DialogResult.OK Then
strFilename = .FileName()
Else
Exit Sub
End If
End With
' Save the file (comment out the above if
' statement to use the default opened filename)
SaveFile(strFilename)
End Sub

#End Region

#Region "Save File (SUB)"

Private Sub SaveFile(ByVal sFilename As String)
' Create a new stream writer object
sw = New IO.StreamWriter(strFilename)
' Add the contents of the textboxes to the file
sw.WriteLine(TextBox2.Text)
sw.WriteLine(TextBox3.Text)
sw.WriteLine(TextBox4.Text)
sw.WriteLine(TextBox5.Text)
sw.WriteLine(TextBox6.Text)
sw.WriteLine(TextBox7.Text)
sw.WriteLine(TextBox8.Text)
sw.WriteLine(TextBox9.Text)
sw.WriteLine(TextBox10.Text)
sw.WriteLine(TextBox11.Text)
sw.WriteLine(TextBox12.Text)
sw.WriteLine(TextBox13.Text)
sw.WriteLine(TextBox14.Text)
sw.WriteLine(TextBox15.Text)
sw.WriteLine(TextBox16.Text)
sw.WriteLine(TextBox17.Text)
' Close the stream writer
sw.Close()
' Destroy the stream writer object
sw = Nothing
End Sub

#End Region

#Region "Form Load()"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Disable the save & clear buttons,
' but enable the open button
EnableDisableButtons(False)
End Sub

#End Region

#Region "Enable Or Disable Buttons"

Private Sub EnableDisableButtons(ByVal bEnabled As Boolean)
' Open button (Opposite to the other buttons)
Button1.Enabled = Not bEnabled
' Save button (enable/disable)
Button2.Enabled = bEnabled
' Clear button (enable/disable)
Button3.Enabled = bEnabled
End Sub

#End Region

#Region "Clear Button"

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim obj As Object
' Iterate through objects on the form
For Each obj In Me.Controls
' If its a textbox then clear its contents
If TypeOf obj Is TextBox Then
obj.text = "" ' Can say 'obj.text = String.Empty' too
End If
Next
' Clear the filename from
' the strfilename variable
strFilename = String.Empty
' 'Set the focus to the open button
Button1.Focus()
End Sub

#End Region

#Region "Close Application"

Private Sub CloseApplication()
' Close the stream reader if its open
If Not sr Is Nothing Then sr.Close()
' Close the stream writer if its open
If Not sw Is Nothing Then sw.Close()
' Exit the application
Application.Exit()
End Sub
#End Region

#Region "Exit Button"

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
' Exit the application
CloseApplication()
End Sub

#End Region

#Region "Form Closing Event()"

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
' Exit the application
CloseApplication()
End Sub

#End Region

#Region "Textbox1 Got Focus Event()"

Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.GotFocus
' Give the open button the focus
Button1.Focus()
End Sub

#End Region

End Class

--------------------------------------------------------

Its 4am here & I am off to bed once I have heard from you. Please don't keep
me waiting too long.

I hope this helps.
Nov 21 '05 #10
did not help, gave me a few errors, plus im trying to do it to my application
i already wrote, if thats not possible then il find some other way to do it,
so is there anyway to add a save code to create a file save info to it and
then be able to open it up exactly how i want it without haveing to start
over? and u can just go to bed and if u want, work on it tmrrw, im in no
hurry, uve already helped me tremedously, so thnks
Nov 21 '05 #11
Using write will just append text to the end without any spaces so its one
long string. There isn't even a space between your saved code either.

So, you want to save the code & then re-open it immediately. I am really
lost by what you want exactly.

The project I posted before never gave me one single error whatsoever. It
took me over an hour to knock up too. If you want to create a file then just
do a new streamwriter object & then close it.

Dim sw As New StreamWriter("C:\MyTextFile.txt")
sw.Close

The above creates an empty

Dim sw As New StreamWriter("C:\MyTextFile.txt")
For i As Integer = 0 To 15
Console.WriteLine(i)
Next
sw.Close

Now you have a text file with numbers from 0 to 15, which won't error in my
example when you open it up.

I think the best idea is to expand all of your code behind the form
(including form designer code) & thencopy/paste it into here. The explain in
clear terms what you want.

BTW: You are assuming that I will work on your problem tomorrow. As I said
to you yesterday: 'I am not your personal coder'. If you want someone to
write an application for you then go to: http://www.rentacoder.com

Yes, I am going to bed now as its 05:16am. I have just over an hour before I
need to be awake again.

Good night.

"Crouchie1998" wrote:
I have coded this for you. It is written in EXTREMELY easy code so you can
understand it. I could remove the repetitious code, but I think you would get
lost & not understand it like that.

There is no error checking to keep to code to a minimum.
You will need to create the file first & add text to the textboxes, save it
or you will get an index out of bounds error. I suggest, you comment out the
line of code in FORM LOAD, which will enable the save buttons, type something
in all the textboxes & save it. Then uncomment the line of text in FORM LOAD
again to disable the buttons again.

As before: Create a new Windows application & replace ALL form code... with
this:
-----------------------------------------------------------------------------------------------

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
Friend WithEvents TextBox10 As System.Windows.Forms.TextBox
Friend WithEvents TextBox11 As System.Windows.Forms.TextBox
Friend WithEvents TextBox12 As System.Windows.Forms.TextBox
Friend WithEvents TextBox13 As System.Windows.Forms.TextBox
Friend WithEvents TextBox14 As System.Windows.Forms.TextBox
Friend WithEvents TextBox15 As System.Windows.Forms.TextBox
Friend WithEvents TextBox16 As System.Windows.Forms.TextBox
Friend WithEvents TextBox17 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.TextBox8 = New System.Windows.Forms.TextBox
Me.TextBox9 = New System.Windows.Forms.TextBox
Me.TextBox10 = New System.Windows.Forms.TextBox
Me.TextBox11 = New System.Windows.Forms.TextBox
Me.TextBox12 = New System.Windows.Forms.TextBox
Me.TextBox13 = New System.Windows.Forms.TextBox
Me.TextBox14 = New System.Windows.Forms.TextBox
Me.TextBox15 = New System.Windows.Forms.TextBox
Me.TextBox16 = New System.Windows.Forms.TextBox
Me.TextBox17 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.SystemColors.HighlightText
Me.TextBox1.Location = New System.Drawing.Point(16, 8)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.ReadOnly = True
Me.TextBox1.Size = New System.Drawing.Size(488, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(16, 40)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(232, 20)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(16, 72)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(232, 20)
Me.TextBox3.TabIndex = 2
Me.TextBox3.Text = ""
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(16, 104)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(232, 20)
Me.TextBox4.TabIndex = 3
Me.TextBox4.Text = ""
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(16, 136)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(232, 20)
Me.TextBox5.TabIndex = 4
Me.TextBox5.Text = ""
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(16, 168)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(232, 20)
Me.TextBox6.TabIndex = 5
Me.TextBox6.Text = ""
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(16, 200)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(232, 20)
Me.TextBox7.TabIndex = 6
Me.TextBox7.Text = ""
'
'TextBox8
'
Me.TextBox8.Location = New System.Drawing.Point(16, 232)
Me.TextBox8.Name = "TextBox8"
Me.TextBox8.Size = New System.Drawing.Size(232, 20)
Me.TextBox8.TabIndex = 7
Me.TextBox8.Text = ""
'
'TextBox9
'
Me.TextBox9.Location = New System.Drawing.Point(16, 264)
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.Size = New System.Drawing.Size(232, 20)
Me.TextBox9.TabIndex = 8
Me.TextBox9.Text = ""
'
'TextBox10
'
Me.TextBox10.Location = New System.Drawing.Point(272, 40)
Me.TextBox10.Name = "TextBox10"
Me.TextBox10.Size = New System.Drawing.Size(232, 20)
Me.TextBox10.TabIndex = 9
Me.TextBox10.Text = ""
'
'TextBox11
'
Me.TextBox11.Location = New System.Drawing.Point(272, 72)
Me.TextBox11.Name = "TextBox11"
Me.TextBox11.Size = New System.Drawing.Size(232, 20)
Me.TextBox11.TabIndex = 10
Me.TextBox11.Text = ""
'
'TextBox12
'
Me.TextBox12.Location = New System.Drawing.Point(272, 104)
Me.TextBox12.Name = "TextBox12"
Me.TextBox12.Size = New System.Drawing.Size(232, 20)
Me.TextBox12.TabIndex = 11
Me.TextBox12.Text = ""
'
'TextBox13
'
Me.TextBox13.Location = New System.Drawing.Point(272, 136)
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.Size = New System.Drawing.Size(232, 20)
Me.TextBox13.TabIndex = 12
Me.TextBox13.Text = ""
'
'TextBox14
'
Me.TextBox14.Location = New System.Drawing.Point(272, 168)
Me.TextBox14.Name = "TextBox14"
Me.TextBox14.Size = New System.Drawing.Size(232, 20)
Me.TextBox14.TabIndex = 13
Me.TextBox14.Text = ""
'
'TextBox15
'
Me.TextBox15.Location = New System.Drawing.Point(272, 200)
Me.TextBox15.Name = "TextBox15"
Me.TextBox15.Size = New System.Drawing.Size(232, 20)
Me.TextBox15.TabIndex = 14
Me.TextBox15.Text = ""
'
'TextBox16
'
Me.TextBox16.Location = New System.Drawing.Point(272, 232)
Me.TextBox16.Name = "TextBox16"
Me.TextBox16.Size = New System.Drawing.Size(232, 20)
Me.TextBox16.TabIndex = 15
Me.TextBox16.Text = ""
'
'TextBox17
'
Me.TextBox17.Location = New System.Drawing.Point(272, 264)
Me.TextBox17.Name = "TextBox17"
Me.TextBox17.Size = New System.Drawing.Size(232, 20)
Me.TextBox17.TabIndex = 16
Me.TextBox17.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(528, 8)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 17
Me.Button1.Text = "Open"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(528, 40)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 18
Me.Button2.Text = "Save"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(528, 72)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 19
Me.Button3.Text = "Clear"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(528, 104)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 20
Me.Button4.Text = "Exit"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(618, 303)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox17)
Me.Controls.Add(Me.TextBox16)
Me.Controls.Add(Me.TextBox15)
Me.Controls.Add(Me.TextBox14)
Me.Controls.Add(Me.TextBox13)
Me.Controls.Add(Me.TextBox12)
Me.Controls.Add(Me.TextBox11)
Me.Controls.Add(Me.TextBox10)
Me.Controls.Add(Me.TextBox9)
Me.Controls.Add(Me.TextBox8)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Open/Save Example By Crouchie1998"
Me.ResumeLayout(False)

End Sub

#End Region

#Region "Declarations"
' Variable used for filename
Dim strFilename As String
' Variable to hold the default save location
Dim strDefaultLocation As String =
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)
' Stream reader object
Dim sr As IO.StreamReader
' Stream writer object
Dim sw As IO.StreamWriter
#End Region

#Region "Open Button"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With OpenFileDialog1
' Open in Desktop directory
.InitialDirectory = strDefaultLocation
' Set up filters
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
' Select text files
.FilterIndex = 0
' Show dialog
If .ShowDialog = DialogResult.OK Then
' User pressed OK
' Pass the filename to the
' 'strFilename' variable
strFilename = .FileName()
' Show the file path in the textbox
TextBox1.Text = strFilename
Else
' User pressed cancel
Exit Sub
End If
End With
' Open the file chosen
' by the user
OpenFile(strFilename)
End Sub

#End Region

#Region "Open File (SUB)"

Private Sub OpenFile(ByVal sFilename As String)
' Create a new stream reader object
sr = New IO.StreamReader(sFilename)
' Variable to hold lines in the text file
Dim strLines() As String
' Variable to hold the file contents
Dim strLine As String
' Read the entire file (16 lines)
strLine = sr.ReadToEnd
' Seperate those lines
strLines = strLine.Split(ControlChars.CrLf)
' Pass those lines to the textboxes
TextBox2.Text = strLines(0).Trim
TextBox3.Text = strLines(1).Trim
TextBox4.Text = strLines(2).Trim
TextBox5.Text = strLines(3).Trim
TextBox6.Text = strLines(4).Trim
TextBox7.Text = strLines(5).Trim
TextBox8.Text = strLines(6).Trim
TextBox9.Text = strLines(7).Trim
TextBox10.Text = strLines(8).Trim
TextBox11.Text = strLines(9).Trim
TextBox12.Text = strLines(10).Trim
TextBox13.Text = strLines(11).Trim
TextBox14.Text = strLines(12).Trim
TextBox15.Text = strLines(13).Trim
TextBox16.Text = strLines(14).Trim
TextBox17.Text = strLines(15).Trim
' Close the stream reader
sr.Close()
' Destroy the stream reader object
sr = Nothing
' Enable the save & clear buttons, plus
' disable the open button
EnableDisableButtons(True)
End Sub

#End Region

#Region "Save Button"

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
' See open file dialog for info on this
With SaveFileDialog1
' Default extension to use
.DefaultExt = "txt"
.InitialDirectory = strDefaultLocation
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
.FilterIndex = 0
If .ShowDialog = DialogResult.OK Then
strFilename = .FileName()
Else
Exit Sub
End If
End With
' Save the file (comment out the above if
' statement to use the default opened filename)
SaveFile(strFilename)
End Sub

#End Region

#Region "Save File (SUB)"

Private Sub SaveFile(ByVal sFilename As String)
' Create a new stream writer object
sw = New IO.StreamWriter(strFilename)
' Add the contents of the textboxes to the file
sw.WriteLine(TextBox2.Text)
sw.WriteLine(TextBox3.Text)
sw.WriteLine(TextBox4.Text)
sw.WriteLine(TextBox5.Text)
sw.WriteLine(TextBox6.Text)
sw.WriteLine(TextBox7.Text)
sw.WriteLine(TextBox8.Text)
sw.WriteLine(TextBox9.Text)
sw.WriteLine(TextBox10.Text)
sw.WriteLine(TextBox11.Text)
sw.WriteLine(TextBox12.Text)
sw.WriteLine(TextBox13.Text)
sw.WriteLine(TextBox14.Text)
sw.WriteLine(TextBox15.Text)
sw.WriteLine(TextBox16.Text)
sw.WriteLine(TextBox17.Text)
' Close the stream writer
sw.Close()
' Destroy the stream writer object
sw = Nothing
End Sub

#End Region

#Region "Form Load()"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Disable the save & clear buttons,
' but enable the open button
EnableDisableButtons(False)
End Sub

#End Region

#Region "Enable Or Disable Buttons"

Private Sub EnableDisableButtons(ByVal bEnabled As Boolean)
' Open button (Opposite to the other buttons)
Button1.Enabled = Not bEnabled
' Save button (enable/disable)
Button2.Enabled = bEnabled
' Clear button (enable/disable)
Button3.Enabled = bEnabled
End Sub

#End Region

#Region "Clear Button"

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim obj As Object
' Iterate through objects on the form
For Each obj In Me.Controls
' If its a textbox then clear its contents
If TypeOf obj Is TextBox Then
obj.text = "" ' Can say 'obj.text = String.Empty' too
End If
Next
' Clear the filename from
' the strfilename variable
strFilename = String.Empty
' 'Set the focus to the open button
Button1.Focus()
End Sub

#End Region

#Region "Close Application"

Private Sub CloseApplication()
' Close the stream reader if its open
If Not sr Is Nothing Then sr.Close()
' Close the stream writer if its open
If Not sw Is Nothing Then sw.Close()
' Exit the application
Application.Exit()
End Sub
#End Region

#Region "Exit Button"

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
' Exit the application
CloseApplication()
End Sub

#End Region

#Region "Form Closing Event()"

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
' Exit the application
CloseApplication()
End Sub

#End Region

#Region "Textbox1 Got Focus Event()"

Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.GotFocus
' Give the open button the focus
Button1.Focus()
End Sub

#End Region

End Class

--------------------------------------------------------

Its 4am here & I am off to bed once I have heard from you. Please don't keep
me waiting too long.

I hope this helps.

Nov 21 '05 #12
Crouchie1998, could you possibly write an application for me? I will send you the spec's and if you can have it done in a couple
of days I would appreciate it! :-)
(don't shoot.............I just couldn't resist)
james
"Crouchie1998" <Cr**********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
Using write will just append text to the end without any spaces so its one
long string. There isn't even a space between your saved code either.

So, you want to save the code & then re-open it immediately. I am really
lost by what you want exactly.

The project I posted before never gave me one single error whatsoever. It
took me over an hour to knock up too. If you want to create a file then just
do a new streamwriter object & then close it.

Dim sw As New StreamWriter("C:\MyTextFile.txt")
sw.Close

The above creates an empty

Dim sw As New StreamWriter("C:\MyTextFile.txt")
For i As Integer = 0 To 15
Console.WriteLine(i)
Next
sw.Close

Now you have a text file with numbers from 0 to 15, which won't error in my
example when you open it up.

I think the best idea is to expand all of your code behind the form
(including form designer code) & thencopy/paste it into here. The explain in
clear terms what you want.

BTW: You are assuming that I will work on your problem tomorrow. As I said
to you yesterday: 'I am not your personal coder'. If you want someone to
write an application for you then go to: http://www.rentacoder.com

Yes, I am going to bed now as its 05:16am. I have just over an hour before I
need to be awake again.

Good night.

Nov 21 '05 #13
In your dreams!! Why should I write you an application for FREE? I use these
messageboards to help people not to do their work for them

Nov 21 '05 #14
LOL
Nov 21 '05 #15
can anybody tell me how to create and write text box info and a backghround
image to a file in a windows application using the savedialog? im using
visual studio.net 2003, any help would be aprriciated
Nov 21 '05 #16
You didn't see the Smiley????? :-)
I was just noticing a bit of frustration with this particular thread and couldn't resist messing with you a bit. Sorry if I
stepped on your toes!.
james

"Crouchie1998" <Cr**********@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
In your dreams!! Why should I write you an application for FREE? I use these
messageboards to help people not to do their work for them

Nov 21 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DeeVee | last post by:
I am very new to the language. I am trying to open up to ten files from a list of many data files and writing them all to one big file. To do this I am getting them individually from the console...
7
by: Fred H | last post by:
Hi I've tried to find out if and how I can open directories in standard C++, the same way I can open files. To my great suprise, I haven't managed to find out how this is done! I'm using MS...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
11
by: aldrin | last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0 compiler with great difficulty.There is no problem with running this under KDevelop in linux. Any help would be greatly...
1
by: sunil | last post by:
Hi all, I have a web application in which I have to open a "chm" file that exists on the local file system. I am able to open other files such as PDF, DOC files by writing the Response's output...
1
by: raghu | last post by:
i want to know the difference between 'r' mode and 'r+' mode 1.i = open('c:\python25\integer.txt','w')-------->for writiing i.write('hai')--------->written some content in text file i =...
1
by: jtertin | last post by:
I am currently using the following code to make sure a file is writable (i.e. is not in use) by using the CanWrite method of the FileStream object. Using the code below, the TextWriter is still...
12
by: mohdalibaig | last post by:
Is it possible to open other files in C during main() execution. Example, i want to open a wave file that generates a sound when ever main() function is called.
34
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.