Click here to Skip to main content
15,918,243 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Develop Antivirus (Urgent !) Pin
Milind Panchal15-Mar-09 23:17
Milind Panchal15-Mar-09 23:17 
AnswerRe: Develop Antivirus (Urgent !) Pin
Christian Graus15-Mar-09 18:31
protectorChristian Graus15-Mar-09 18:31 
GeneralRe: Develop Antivirus (Urgent !) Pin
Milind Panchal15-Mar-09 23:18
Milind Panchal15-Mar-09 23:18 
QuestionTextBox to autopostback "automatically" when text.length = x Pin
suni_dotnet15-Mar-09 12:44
suni_dotnet15-Mar-09 12:44 
AnswerRe: TextBox to autopostback "automatically" when text.length = x Pin
Christian Graus15-Mar-09 12:55
protectorChristian Graus15-Mar-09 12:55 
GeneralRe: TextBox to autopostback "automatically" when text.length = x Pin
suni_dotnet15-Mar-09 13:41
suni_dotnet15-Mar-09 13:41 
GeneralRe: TextBox to autopostback "automatically" when text.length = x Pin
Christian Graus15-Mar-09 14:09
protectorChristian Graus15-Mar-09 14:09 
GeneralRe: TextBox to autopostback "automatically" when text.length = x Pin
suni_dotnet15-Mar-09 14:28
suni_dotnet15-Mar-09 14:28 
GeneralRe: TextBox to autopostback "automatically" when text.length = x Pin
Alok Sharma ji15-Mar-09 17:44
Alok Sharma ji15-Mar-09 17:44 
GeneralRe: TextBox to autopostback "automatically" when text.length = x Pin
Christian Graus15-Mar-09 18:32
protectorChristian Graus15-Mar-09 18:32 
QuestionUnable to get the Identity column value for new row in MSSQL database. Pin
AprNgp15-Mar-09 9:13
AprNgp15-Mar-09 9:13 
AnswerRe: Unable to get the Identity column value for new row in MSSQL database. Pin
Christian Graus15-Mar-09 10:06
protectorChristian Graus15-Mar-09 10:06 
GeneralRe: Unable to get the Identity column value for new row in MSSQL database. Pin
AprNgp15-Mar-09 21:01
AprNgp15-Mar-09 21:01 
Questionhow to call Pin
JAYRAJ GIRI15-Mar-09 6:06
JAYRAJ GIRI15-Mar-09 6:06 
AnswerRe: how to call Pin
Expert Coming15-Mar-09 6:26
Expert Coming15-Mar-09 6:26 
GeneralRe: how to call Pin
Christian Graus15-Mar-09 10:19
protectorChristian Graus15-Mar-09 10:19 
AnswerRe: how to call Pin
Christian Graus15-Mar-09 10:18
protectorChristian Graus15-Mar-09 10:18 
Questionequivalent of string.contains(vs2005) in vs2003. Pin
bishwambhar_sen15-Mar-09 1:31
bishwambhar_sen15-Mar-09 1:31 
AnswerRe: equivalent of string.contains(vs2005) in vs2003. Pin
N a v a n e e t h15-Mar-09 3:50
N a v a n e e t h15-Mar-09 3:50 
Questionsetting DropDownList value Pin
liz315-Mar-09 0:44
liz315-Mar-09 0:44 
AnswerRe: setting DropDownList value Pin
Expert Coming15-Mar-09 5:44
Expert Coming15-Mar-09 5:44 
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 
HI. got a project where you have a file menu, and you open a text file, then save the text file. and a exit menu item. now, if i click the open file menu item, it displays two text boxes, where you enter a name and phone number. but for some stupid reason, if i click the save menu item, i get a message saying the file needs to be open, and does not save the file? so what am i doing wrong and how to fix this? any help would be gretefully aprreciated. will post the code below. cheers Marvin.

'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

End With


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 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.


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

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.