Skip to main content

Posts

Vb.Net Code to get Financial Year

Function GETFINYR(ByVal strDate) Dim strDt, strenddt, strstdt Dim strdd, strmm, stryy, strst_dt, strend_dt Dim date1, enddate, startdate strDt = Split(strDate, "/") strdd = strDt(0) strmm = strDt(1) stryy = strDt(2) If Right(stryy, 2) = "99" Then strend_dt = "31/03/" & Left(stryy, 2) + 1 & "00" Else If Right(stryy, 1) <> "9" Then strend_dt = "31/03/" & Left(stryy, 3) & Right(stryy, 1) + 1 Else strend_dt = "31/03/" & Left(stryy, 2) & Right(stryy, 2) + 1 End If End If strenddt = Split(strend_dt, "/") strst_dt = "01/04/" & stryy strstdt = Split(strst_dt, "/") date1 = CDate(CInt(stryy) & "/" & CInt(strmm) & "/" & CInt(strdd)) enddate = CDate(CInt(strenddt(2)) & "/" & CInt(strenddt(1)) & "/" & CInt(strenddt(0))) startdat

Search Record in Grid Using Vb.Net Code

Search Record in Grid Using Vb.Net Code If intOldcnt <= IntTblCount - 1 Then dgMain.UnSelect(intOldcnt) End If Dim inti As Integer If strToSearch.Trim <> "" Then For inti = 0 To IntTblCount - 1 If Convert.ToString(dgMain.Item(inti, 0)).Trim.ToUpper Like strToSearch.Trim.ToUpper & "*" Then If blnFlag = True Then dgMain.Select(inti) IntCount += 1 End If dgMain.CurrentRowIndex = inti intOldcnt = inti txtSearch.Focus() Exit For End If Next End If

Common crystal report code for asp.net program

Imports System.Data.SqlClient Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports System.data Public Class CrysReport ‘Variables Declaration Private obj As New Class1 Dim crParameterDiscreteValue As ParameterDiscreteValue Dim crconnectionInfo As New ConnectionInfo Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldLocation As ParameterFieldDefinition Dim thisFormulaField As CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition Dim crParameterValues As ParameterValues Dim crtableLogoninfos As New TableLogOnInfos() Dim crtableLogoninfo As New TableLogOnInfo() Dim CrTables As Tables Dim CrTable As Table ‘This function is to shows value through formula text Public Sub report_date_formula(ByVal crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal from_date As String, ByVal to_date As String) Try For Each thisFormulaField In crRep

Set label in MDI Form from table using Timer in visual basic

This is code sample to Set label in MDI Form on which label data taken from table using Timer in visual basic language. Dim rs As New Recordset Private Sub MDIForm_Load() open_recordset "select *from MASTER1 ", rs MDIForm1.Top = 0 MDIForm1.Left = 0 MDIForm1.Width = Screen.Width MDIForm1.Height = Screen.Height End Sub Private Sub MDIForm_Unload(Cancel As Integer) Timer1.Enabled = False rs.Close End Sub Private Sub Timer1_Timer() While Not rs.EOF If rs.Fields(0).Value = Format(Date, "dd/MM/yy") Then myform(i).Label1 = rs.Fields(1).Value myform(i).Show End If i = i + 1 rs.MoveNext Wend If Not rs.EOF Then rs.MoveFirst End If Timer1.Enabled = False End Sub

Some thoughts to think upon

We love ourselves even after doing many mistakes. Then how can we hate others for their one mistake. Think before you hate someone or hate yourself. Swimming along the flow is effortless but swimming against it needs effort.Don't go the way life takes you, but take life the way you wanna go. Dare to be different.  The greatest advantage of speaking the truth is that you don't have to remember what you said. Think about it. A beautiful saying: If your eyes are positive you would like all the people in the world. But if your tongue is positive all the people in the world like you. Life is about the art of drawing without an eraser, so be careful while taking decisions about the most valuable pages of your life. A nice thought: I met money and said why everyone runs behind you, you are just a piece of paper. Money smiled and said of-course I am just a piece of paper, but I haven't seen a dustbin yet in my whole life. Life is like a coin. Pleasure and Pain are the two si

code to send Mail From Web Application using c sharp

using System.Web.Mail; using System; public class MailSender { public static bool SendEmail( string pGmailEmail, string pGmailPassword, string pTo, string pSubject, string pBody, MailFormat pFormat, string pAttachmentPath ) { MailMessage myMail = new MailMessage(); myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","smtp.gmail.com"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpserverport","465"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusing","2"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1"); //Use 0 for anonymous myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusername",pGmailEmail); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword&q

Encrypt Decrypt password using asp dot net

using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Security.Cryptography; namespace xyz { class abc { public static string Encrypt(string plainText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize) { // Convert strings into byte arrays. // Let us assume that strings only contain ASCII codes. // If strings include Unicode characters, use Unicode, UTF7, or UTF8 // encoding. byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); // Convert our plaintext into a byte array. // Let us assume that plaintext contains UTF8-encoded characters. byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); // First, we must create a password, from which the key will be derived. // This password will be generated from the specified passphrase and