Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-08-2009
Member
 
Join Date: Apr 2009
Posts: 79
Save button code in visual basic 2008

I am looking for code which save the item selected from combo box and from check box, the value displayed after selection must be save after clicking save button. Can any one tell me the save button code in visual basic 2008.
Reply With Quote
  #2  
Old 12-08-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Save button code in visual basic 2008

Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal a As System.EventArgs) Handles but.Click
Dim filnam As String
Try
With SaveFileDialog1

.AddExtension = True
.CheckPathExists = True
.CreatePrompt = False
.OverwritePrompt = True
.ValidateNames = True
.ShowHelp = True
.DefaultExt = "txt"
.FileName = filename
.Filter = _
"Text files (*.txt)|*.txt|" & "All files|*.*"
.FilterIndex = 1

If .ShowDialog() = Windows.Forms.DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(.Fil… txt1.Text, False)
End If
End With

Catch y As Exception
MsgBox(e.Message, MsgBoxStyle.Exclamation, M.Text)
End Try
End Sub
End Class
Reply With Quote
  #3  
Old 12-08-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Save button code in visual basic 2008

When you click on save button where the data want to go? If you to save data in data base then you need interlink,As far as saving the data (anywhere) you can research the Form_Close event, this is where you would put the code to save your data, then it will save it as the form is closing.
Reply With Quote
  #4  
Old 12-08-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Save button code in visual basic 2008

The code for save button in visual basic 2008 :

Code:
Sub SaveToTextFile() Handles savebutton.Click
Dim objWriter As New StreamWriter( "save.txt" )
objWriter.Write( savetxt.Text )
objWriter.Close()
End Sub
Reply With Quote
  #5  
Old 23-08-2009
Member
 
Join Date: Aug 2009
Posts: 1
Re: Save button code in visual basic 2008

Quote:
Originally Posted by Walby View Post
When you click on save button where the data want to go? If you to save data in data base then you need interlink,As far as saving the data (anywhere) you can research the Form_Close event, this is where you would put the code to save your data, then it will save it as the form is closing.
What do you mean by an "interlink. I am trying to save data to an sql database and this looks like the code I need but do not understand the interlink requirement.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Save button code in visual basic 2008"
Thread Thread Starter Forum Replies Last Post
help on visual basic 2008 gladys_ny Software Development 1 18-03-2011 04:25 AM
How to save audio files in Visual Basic ? jyothiststvla Software Development 1 19-02-2010 06:22 AM
Form Help in MS Visual Basic 2008! NGV BalaKrishna Software Development 5 21-01-2010 10:07 PM
Error Code 1330 while installing Visual Basic 2008 Capers Windows Software 2 02-05-2009 07:11 PM
Visual Basic 2008 & VB.net Difference any? samit Software Development 4 05-08-2008 07:44 PM


All times are GMT +5.5. The time now is 08:42 AM.