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 »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 »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 »Delete file by previous date with VBScript
VBScript (“Microsoft Visual Basic Scripting Edition”) Script delete file by previous date 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 »Check directory exists path with VB.NET
Imports namespace System.IO as first. If Directory.Exists(Directory Path) = False Then MsgBox(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) End If
Read more »Enter only number on Text box with VB.Net
If Char.IsDigit(e.KeyChar) Or Asc(e.KeyChar) = 8 Then e.Handled = False Else e.Handled = True End If
Read more »