XlBordersIndex enumeration (Excel) in VB.Net

XlBordersIndex enumeration (Excel) For more information: excel.xlbordersindex
Read more »Numbers to word text currency in Crystal Report

numbervar nAmount := 1000.99; numberVar nRemain:= Remainder(nAmount,1); numberVar IntAmount := Truncate(nAmount); stringVar sWordAmount:= ToWords(Truncate(nAmount),0); if nRemain > 0 and IntAmount > 0 then sWordAmount:= sWordAmount +” Baht And “+ ToWords(round(nRemain,2)*100,0)+” Satang” else if nRemain > 0 and IntAmount…
Read more »How to make datagridview cell readonly in vb.net

Private Sub DataGridView1_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick If e.RowIndex < 0 Then Exit Sub End If If e.ColumnIndex = 1 Then DataGridView1.CurrentCell.ReadOnly = False Else DataGridView1.CurrentCell.ReadOnly = True End If End Sub
Read more »How to Export Data to Excel in VB.NET with type object

Public Class Form1 Private Sub ExportExcel() Dim xlApp As Object If xlApp Is Nothing Then MessageBox.Show(“Excel is not properly installed!!”) Return End If Dim i As Integer Dim xlWorkBook As Object Dim xlhdWorkSheet As Object xlWorkBook = xlApp.Workbooks.Add…
Read more »How to Export Data to Excel in VB.NET

Set target framework: .Net framework 4 Add references: Microsoft.Office.Interop.Excel Example code: Imports Excel = Microsoft.Office.Interop.Excel Public Class Form1 Private Sub ExportExcel() Dim xlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application() If xlApp Is Nothing Then MessageBox.Show(“Excel is not properly installed!!”)…
Read more »Export data to another instance in Microsoft SQL Server Management Studio

Open Microsoft SQL Server Management Studio and open object explorer. Right click database name and select tasks and then click export data. And then click next And then select the source from which to copy data. And then…
Read more »Write and read ini file with VB.Net

Private Declare Auto Function GetPrivateProfileString Lib “kernel32” (ByVal lpAppName As String, _ ByVal lpKeyName As String, _ ByVal lpDefault As String, _ ByVal lpReturnedString As StringBuilder, _ ByVal nSize As Integer, _ ByVal lpFileName As String) As Integer…
Read more »Backup database MS SQL Server with command-line SQLCmd

The sqlcmd utility is a command-line utility for ad hoc, interactive execution of Transact-SQL statements and scripts and for automating Transact-SQL scripting tasks. Transact-SQL statements: sqlcmd -S <ComputerName>\<InstanceName> or sqlcmd -S .\<InstanceName> Connecting to a named instance by…
Read more »Copies file data from one location to another with Robocopy

Robocopy is a command-line directory and/or file replication command for Microsoft Windows. Robocopy functionally replaces Xcopy. Developers by Microsoft. robocopy c:\directorya d:\directoryz /MOV /IS /R:5 > “c:\directory A\Logfile.txt” or robocopy “c:\directory a” “d:\directory z” /MOV /IS /R:5 >…
Read more »Delete file by previous month with VBScript

VBScript (“Microsoft Visual Basic Scripting Edition”) Script delete file by previous month with VBScript Set shell = CreateObject(“WScript.Shell”) ‘Set for call batch file shell.CurrentDirectory = “c:\Testscript” ‘Location batch file Set fso = CreateObject(“Scripting.FileSystemObject”) startFolder = “d:\FileBackup” ‘Folder to start deleting (subfolders…
Read more »