Click here to Skip to main content
15,887,485 members
Home / Discussions / ASP.NET
   

ASP.NET

 
General[Message Deleted] Pin
liz315-Mar-09 5:50
liz315-Mar-09 5:50 
GeneralRe: setting DropDownList value Pin
Expert Coming15-Mar-09 5:52
Expert Coming15-Mar-09 5:52 
GeneralRe: setting DropDownList value Pin
Expert Coming15-Mar-09 5:53
Expert Coming15-Mar-09 5:53 
Questionfile reading and writing problems Pin
StarTrekCafe15-Mar-09 0:31
StarTrekCafe15-Mar-09 0:31 
AnswerRe: file reading and writing problems Pin
Mustafa Ismail Mustafa15-Mar-09 4:00
Mustafa Ismail Mustafa15-Mar-09 4:00 
AnswerRe: file reading and writing problems Pin
Expert Coming15-Mar-09 5:45
Expert Coming15-Mar-09 5:45 
AnswerRe: file reading and writing problems Pin
StarTrekCafe15-Mar-09 16:04
StarTrekCafe15-Mar-09 16:04 
AnswerRe: file reading and writing problems Pin
StarTrekCafe15-Mar-09 18:06
StarTrekCafe15-Mar-09 18:06 
Hi. welltried your suggestion, but think i got my self a bit confused and a bit muddled. so will paste the error below. got an exception error for line 96. can any one help. will paste the error as a graphic below and the code. so help me to get this working. what should i take out and keep in the code? cheers Marvin.

sender As Object, ByVal e As System.EventArgs) Han

'Program: Ch11 Open and Write File
'Programmer: Marvin Hunkin
'Date:Saturday March 7 2009
'Description: Allow the user to enter names and phone numbers and
' save them in a file.


Imports System.IO


Public Class frmCh11OpenAndWriteFile


' Declare module-level variable.


Dim PhoneStreamWriter As StreamWriter


Private Sub menSaveToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menSaveToolStripMenuItem.Click


' Save the record to the file.


If PhoneStreamWriter IsNot Nothing Then ' Is the file open?

With Me


PhoneStreamWriter.WriteLine(.tbNameTextBox.Text)
PhoneStreamWriter.WriteLine(.tbPhoneTextBox.Text)

With .tbNameTextBox
.Clear()
.Focus()

End With

With .tbPhoneTextBox
.clear()
.focus()


End With


.tbPhoneTextBox.clear()


End With

Else ' File is not open
MessageBox.Show("You must open the file before you can save a record", _
"File Not Open", MessageBoxButtons.OK, MessageBoxIcon.Information)


End If

End Sub

Private Sub menOpenToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menOpenToolStripMenuItem.Click


' Open the file.



dim strFilePath as String = "c:\Test.txt"
Dim dlgResponseDialogResult As DialogResult


' Is the file already open?

If PhoneStreamWriter IsNot Nothing Then
PhoneStreamWriter.Close()


End If


' Begin in the project folder.


dlgOpenFileDialog.InitialDirectory = "C:\" ' Display the File Open dialog box.


' Make sure that the user didn’t click the Cancel button.


If dlgResponseDialogResult <> DialogResult.Cancel Then


' Open the output file.


PhoneStreamWriter.WriteLine(tbNameTextBox.Text)
PhoneStreamWriter.WriteLine(tbPhoneTextBox.Text)



End If


End Sub

Private Sub menExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menExitToolStripMenuItem.Click


' Close the file and the form.


If PhoneStreamWriter IsNot Nothing Then ' Is the file open?

PhoneStreamWriter.Close()

End If

Me.Close()


End Sub
End Class
QuestionNot Gorogrian Calander In Asp.net Pin
Mohamed Ibrahim Omar15-Mar-09 0:25
Mohamed Ibrahim Omar15-Mar-09 0:25 
AnswerRe: Not Gorogrian Calander In Asp.net Pin
Mustafa Ismail Mustafa15-Mar-09 3:49
Mustafa Ismail Mustafa15-Mar-09 3:49 
General[Message Deleted] Pin
Mohamed Ibrahim Omar15-Mar-09 20:43
Mohamed Ibrahim Omar15-Mar-09 20:43 
GeneralRe: Not Gorogrian Calander In Asp.net Pin
Mohamed Ibrahim Omar15-Mar-09 20:43
Mohamed Ibrahim Omar15-Mar-09 20:43 
Questionvb mail project problems Pin
StarTrekCafe15-Mar-09 0:25
StarTrekCafe15-Mar-09 0:25 
AnswerRe: vb mail project problems Pin
Christian Graus15-Mar-09 9:59
protectorChristian Graus15-Mar-09 9:59 
Questiontickets Project Help Pin
StarTrekCafe15-Mar-09 0:11
StarTrekCafe15-Mar-09 0:11 
AnswerRe: tickets Project Help Pin
Christian Graus15-Mar-09 10:08
protectorChristian Graus15-Mar-09 10:08 
AnswerRe: tickets Project Help Pin
StarTrekCafe15-Mar-09 13:33
StarTrekCafe15-Mar-09 13:33 
AnswerRe: tickets Project Help Pin
StarTrekCafe15-Mar-09 13:35
StarTrekCafe15-Mar-09 13:35 
QuestionLogin Project Problems Pin
StarTrekCafe15-Mar-09 0:02
StarTrekCafe15-Mar-09 0:02 
AnswerRe: Login Project Problems Pin
Abhijit Jana15-Mar-09 2:13
professionalAbhijit Jana15-Mar-09 2:13 
GeneralRe: Login Project Problems Pin
Colin Angus Mackay15-Mar-09 3:05
Colin Angus Mackay15-Mar-09 3:05 
AnswerRe: Login Project Problems Pin
StarTrekCafe15-Mar-09 13:41
StarTrekCafe15-Mar-09 13:41 
Questionproblem in cast value from money to decimal Pin
Sneha Bisht14-Mar-09 23:34
Sneha Bisht14-Mar-09 23:34 
AnswerRe: problem in cast value from money to decimal Pin
Colin Angus Mackay15-Mar-09 3:10
Colin Angus Mackay15-Mar-09 3:10 
Questionasp.net grid view [modified] Pin
PleaseHelpCP14-Mar-09 22:12
PleaseHelpCP14-Mar-09 22:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.