naidelih says: Hello World!!!

just my online notebook

Entries for the ‘vb.net’ Category

Retrieving ole object from access database in vb.net

After saving your documents, images  to an ole object in access database below is the script to retrieve it back as a file in vb.net.

Public Function RetrieveData(ByVal mRef As Long, ByVal mFilePath As String, ByVal mTableName As String, ByVal mCols As String)

        'mFilePath selected location to save the file + filename.

    [...]

Saving picture/images to access database in vb.net

You can save pictures, document, music files and etc in an ole object in access database. im this example i intend to store picture file.

Public Function StoreDataToAccess(ByVal mref As Long, ByVal mTransactionType As String, ByVal mFilePath As String, ByVal mTableName As String, ByVal mColPictureFile As String, ByVal mColPictureFileName As String)

        Dim file [...]

Changing crystal report database location in runtime

Dim strDSN As System.String

Dim strDB As System.String

Dim strUID As System.String

Dim strPWD As System.String

 

Private Sub LoadReports()

 

        Dim mDBLocation As String

        mDBLocation = Environment.CurrentDirectory & "\" & "Database.mdb"

 

        Try

            Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

            Application.DoEvents()

        [...]

StreamReader in vb.net

Reading text file using streamreader;

Imports System.IO

 

 

  Dim list As New List(Of String)

        ' Open file.txt with the Using statement.

        Using r As StreamReader = New StreamReader("file.txt")

            ' Store contents in this String.

            Dim line As String

 

        [...]

Sending Email using yahoo or gmail account in visual basic.net

Sending email using your gmail or yahoo account.

Private Function mailSend(maccount as string, AccPassword as string, mrecipient as string, msubject as string, mbody as string, accountsmtp as string) As Boolean

Try

Dim accountname As String = maccount

Dim loginfo As New NetworkCredential(accountname , AccPassword )

Dim msg As New MailMessage

msg.From = New MailAddress(gmailaccount)

msg.To.Add(New MailAddress(mrecipient ))

msg.Subject = msubject

msg.Body = mbody

msg.IsBodyHtml [...]