by Julito Amodia (8 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 25th June 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Modules Code Sample
'*#Synopsis NG Return Component Module
'
'*#History 2006.06.15 J. Amodia - Create
'
'
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Amodia Added - 2006.06.08
'Read from Ini file API declaration
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
'writes to ini file API declaration
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lpFileName As String) As Long
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public MainForm As frmMainNG
' Message Box
Public Const MESSAGE1 = "Please fill up every required details."
Public Const MESSAGE2 = "Good Qty not more than Delivered Quantity"
Public Const MESSAGE3 = "Please Fill it up"
Public Const MESSAGE4 = "Please follow the given date format."
Public Const MESSAGE5 = "New Record is added to the System"
Public Const MESSAGE6 = "The record is updated in database"
Public Const MESSAGE7 = "No Item available for Editing"
Public Const MESSAGE8 = "No Item available for Searching"
Public Const MESSAGE9 = "No Item available for Printing"
Public Const MESSAGE10 = "The record is updated in database"
Public Const MESSAGE11 = "No Item available for Saving"
Public Const MESSAGE12 = "From Date cannot be greater than To Date."
Public Const MESSAGE13 = "No item to be Deleted"
Public Const MESSAGE14 = "From Date cannot be greater than To Date."
Enum tagEnum_WorkingLevel
WM_MAKER = 101
WM_ADMIN = 102
WM_USER = 103
WM_GUEST = 104
End Enum
' 2006.06.23 J. Amodia
Enum tagEnum_Message
WM_SAVE = 0
WM_DELETE = 1
WM_CLOSE = 2
WM_PRINT = 3
WM_COPY = 4
WM_PASTE = 5
WM_CUT = 6
WM_FILTER = 100
End Enum
Public Const GRDCOLNUMBER = 18
Public Const GRDAPPNAME = "GRID DIMENSION" 'Grid name
Public Const GRDKEY0 = "RS_NO"
Public Const GRDKEY1 = "LCTN_NO"
Public Const GRDKEY2 = "ITEM_ID"
Public Const GRDKEY3 = "ITEM_NAME"
Public Const GRDKEY4 = "INVOICE_NUMBER"
Public Const GRDKEY5 = "SUPPLIER_OR_NUMBER"
Public Const GRDKEY6 = "DELIVERY_DATE"
Public Const GRDKEY7 = "DELIVERED_QUANTITY"
Public Const GRDKEY8 = "UNIT_PRICE"
Public Const GRDKEY9 = "DATE_INSPECTED"
Public Const GRDKEY10 = "GOOD_QTY"
Public Const GRDKEY11 = "SUPPLIER"
Public Const GRDKEY12 = "NG_QTY"
Public Const GRDKEY13 = "NG_TOTAL_COST"
Public Const GRDKEY14 = "NG_PERCENT"
Public Const GRDKEY15 = "TYPE_OF_DEFECT"
Public Const GRDKEY16 = "CONDITION"
Public Const GRDKEY17 = "REMARK"
'Public Const GRDKEY18 = "ID"
'Public Const GRDKEY19 = "NGCODE"
Public Const QRSINVENTORYINI = "qrsNGReturn.ini"
Public Const ERROR_LOG = "QRS_Error_Log.txt"
'Create by Julito D. Amodia Dated: 2006.06.15
'*#Description Restricts the keypress input from 0-9 and A-Z only
Public Function Press5(KeyAscii As Integer) As Integer
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 47) Or (KeyAscii = 45) Or (KeyAscii = 32) Or (KeyAscii = 13) Or (KeyAscii = 8) Then
Press5 = KeyAscii
Else
Press5 = 0
End If
End Function
'*#Description Restricts the keypress input from 0-9 only
Public Function PressTotal(KeyAscii As Integer) As Integer
If (KeyAscii >= 1 And KeyAscii <= 57) Then
PressTotal = KeyAscii
Else
PressTotal = 0
End If
End Function
Public Function Press1(KeyAscii As Integer) As Integer
If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Or (KeyAscii = 13) Then
Press1 = KeyAscii
Else
Press1 = 0
End If
End Function
'*#Description Restricts the keypress input from 0-9 and A-Z only
Public Function Press2(KeyAscii As Integer) As Integer
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Or (KeyAscii = 13) Or (KeyAscii = 32) Or (KeyAscii = 45) Then
Press2 = KeyAscii
Else
Press2 = 0
End If
End Function
'*#Description Restricts the keypress input from 0-9 and "/" only
Public Function Press3(KeyAscii As Integer) As Integer
If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Or (KeyAscii = 47) Or (KeyAscii = 13) Then
Press3 = KeyAscii
Else
Press3 = 0
End If
End Function
'******************************************************************************************
'#Name Main function
'*
'*#History 2006.06.15 J. Amodia create
'*****************************************************************************************
Sub Main()
Set MainForm = New frmMainNG
LOAD MainForm
MainForm.Show
End Sub
'******************************************************************************************
'#Name Read INI file FUnction and Write INI File function
'*
'*#History 2006.06.23 J. Amodia create
'*****************************************************************************************
Public Function ReadIniFile(strAppname As String, strKey As String, strFilename As String) As String
'Dim strRetString As String
Dim nRet As Integer
Dim strTemp As String
strTemp = String$(500, 32) 'initialize size with leading spaces
'Read ini file
nRet = GetPrivateProfileString(strAppname, strKey, "", strTemp, Len(strTemp), strFilename)
' ReadIniFile = LTrim(Trim(strTemp)) 'Trim spaces
strTemp = Trim(strTemp) 'Trim spaces
ReadIniFile = Left(strTemp, Len(strTemp) - 1) 'Remove all spaces left
End Function
Public Function WriteIniFile(strAppname As String, strKey As String, strData As String, strFilename As String) As Integer
Dim nRet As Integer
nRet = WritePrivateProfileString(strAppname, strKey, strData, strFilename)
WriteIniFile = nRet
End Function