Friday, April 5, 2013

Java Script for Confirm Box or (yes/no) box

Look At :-
[input id="Button3" onclick="return confirm('Are You Sure?');" type="button" value="button" />]
Eg.

Sending Email From Your Gmail Account in vb.net

Use these namespace and add function to your event on which you want to send email.
*****************************************************************
Imports System.Web
Imports System.Net
Imports System.Net.Mail

Public Function sndmail()
Try

 Dim client As New SmtpClient()
               Dim sendTo As New MailAddress("email of other person")
                Dim from As MailAddress = New MailAddress("youremail")
                Dim message As New MailMessage(from, sendTo)
                message.IsBodyHtml = True
                message.Subject = "Mail subject"
                message.IsBodyHtml = True
                Dim st As String = "Your Mail Body "              
                message.Body = st
                message.IsBodyHtml = True
                Dim basicAuthenticationInfo As New System.Net.NetworkCredential("yourfullemail", "password")
                client.Host = "smtp.gmail.com"
                client.UseDefaultCredentials = False
                client.Credentials = basicAuthenticationInfo
                client.EnableSsl = True
                client.Send(message)

         Catch ex As Exception
            Response.Write("")
        End Try
End Function

******************************************************************

Print A Web Page Javascript

It is just a small function name window.print() you need to call on a button click:-
[input type="button" name="Print" value="Print" onclick="window.print();" /]

Reset All Text Box in windows Form

Public Sub ClearTextBox(ByVal root As Control)
        For Each ctrl As Control In root.Controls
            ClearTextBox(ctrl)
            If TypeOf ctrl Is TextBox Then
                CType(ctrl, TextBox).Text = String.Empty
            End If
        Next ctrl



write the
 ClearTextBox(Me)
under click on reset button