Rabu, 22 Juli 2009

Auto SmartCase

Procedure to change the small letters into capital letters automatically in accordance with the rules of writing, for example, small letters at the beginning of the word, small letters after the space / point.

Rem// AUTHOR

Nandy Novrizal (Original Source Code)

Rem// INTRODUCTION

Procedure to change the small letters into capital letters automatically in accordance with the rules of writing,

such small letters at the beginning of the word, small letters after the space / point.

Rem// PUBLIC PROCEDURE

Sub goSmartCase(TextBoxName As Control, KeyAscii As Integer)
On Error Resume Next
If Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = " " Or _
Mid(TextBoxName.Text, TextBoxName.SelStart,1) = "." _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "" Or _
Mid(TextBoxName.Text,TextBoxName.SelStart, 1) = "(" _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "{" Or _
Mid(TextBoxName.Text,TextBoxName.SelStart, 1) = "[" _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "/" Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Else
KeyAscii = Asc(LCase(Chr(KeyAscii)))
End If
End Sub

Rem// HOW TO USE
Private Sub Text1_KeyPress(KeyAscii As Integer)
goSmartCase Text1, KeyAscii
End Sub



Article

Data Report | Visual Basic

Access the Database with the same time

Have all the partners when we access the database and other users also do same? akbitanya what? Perhaps in the Client-Server architecture sometimes have access to the database by accident at the same time (same time). even world-class drivers michael summacker I even print the score, but on different data packet that is sent does not like drivers, equality can occur when we menyelect databse.


Option Explicit

Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Private Sub Form_Load()
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection

With cn
.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & _
"data source=C:\oks.mdb"
.CursorLocation = adUseClient
.Open
End With
With rs
.ActiveConnection = cn
.LockType = adLockPessimistic
.Open "select * from barang"
End With
rs.MoveLast
If rs.RecordCount = 0 Then
Exit Sub
End If

If cn.BeginTrans = True Then
cn.BeginTrans
End If
rs.MoveFirst
Do Until rs.EOF
If rs("kodebarang") = "2004" Then
rs("kodebarang") = "2005"
rs.Update
End If
rs.MoveNext
Loop
If MsgBox("Apakah Anda yakin untuk menyimpan-nya?", _
vbQuestion + vbYesNo, "Konfirmasi") = vbYes Then
cn.CommitTrans
Else
cn.RollbackTrans
End If
End Sub




Source Code VB

how to remove the Close X button in the menu | How to make animation star | Search for words in ListBox | Retrieving Data / Pictures | Tips And Trick & Animation Form | How To Find Files with VB | Access database with the same time | Auto Smartcase

how to remove the Close X button in the menu

The fire Code Required

Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long

Private Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long

Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As Long

Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long

'
Constant value for the operation menubar
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&

Public Sub HideMenuX(Form As Form)
Dim hSysMenu As Long, nCnt As Long
hSysMenu = GetSystemMenu(Form.hwnd, False)
If hSysMenu Then
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then

'
Basic Menu is the number of 0 (0, 1, 2, 3 ...) RemoveMenu hSysMenu, nCnt - 1, _
MF_BYPOSITION Or MF_REMOVE

'
Remove the separator line before the close RemoveMenu hSysMenu, nCnt - 2, _
MF_BYPOSITION Or MF_REMOVE
DrawMenuBar Form.hwnd
End If
End If
End Sub

Private Sub Command1_Click()
'
call function HideMenu
HideMenuX Me
End Sub