PDA

Click to See Complete Forum and Search --> : Form and code help.


Jes|er
Aug 7th, 2002, 08:06 PM
I have two problems first Im trying to load a new form that tells the user that the file is not yet saved and asks them if they'd like to save the file.

How do I return to the last event if they say no?



Private Sub btnYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYes.Click

'Yes Save the file
Save()
Me.Close()


End Sub

Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click
'No Dont save the file

End Sub


Second when I use this in the main form the txtTextBox.SaveFile is underlined with an error about it not being part of the windows.forms.textbox namespace.



Public Sub Save()

If strFilename = "" Then
SaveFileDialog1.ShowDialog()
strFilename = SaveFileDialog1.FileName
End If


'txtTextBox.SaveFile is underlined below:
txtTextBox.SaveFile(strFilename & ".txt")


Any Ideas?

Cander
Aug 7th, 2002, 09:52 PM
1) use .ShowDialog isntead of Show which makes the form modal so that when it opens, the calling code pauses there until the form is closes


2) Because there is no such method as SaveFile. Dont know where you got that from

Cander
Aug 7th, 2002, 09:53 PM
savefile is part of the RichTextBox, not TextBox

Jes|er
Aug 8th, 2002, 05:26 PM
Thanks for info. Any chance you know another way with #2 ?
A way that I cant list a default extension with textbox.

spcolsen
Aug 14th, 2002, 11:19 PM
So does that mean that if I want to save information on a form I must use RichTextBox's rather that TextBoxes? And does this code work for combobox's as well?