Hello to all.
Today my sample is all above listview. Populate listview of data from database.
If you have ur connectionstring and recordset. Then set 1 listview and 1 commandbutton.
In your command button insert this code:
Dim Item as ListItem 'variable for your subitems
ListView1.ListItems.Clear 'Clear your Listview before loading a new data
While Not rs.eof
Set Item = ListView1.ListItems.Add(,,rs!One)
Item.Subitems(1) = rs!Two
rs.movenext
Wend
Hope this one will help you
Sunday, August 31, 2008
Thursday, August 21, 2008
Numeric only in Textbox
I have function code here. To restrict the input in textbox only for numeric.
Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer
Select Case KeyAscii
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0
Case 45 And InStr(TextBox, "-") = 0
If TextBox.SelStart > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
OnlyNumericKeys = KeyAscii
End Function
Thanks for the help of my friend (mike).
Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer
Select Case KeyAscii
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0
Case 45 And InStr(TextBox, "-") = 0
If TextBox.SelStart > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
OnlyNumericKeys = KeyAscii
End Function
Thanks for the help of my friend (mike).
Removing Maximize Button
Hello there.
This API Codes will help you to remove the maximize button in form.
Public Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const WS_MAXIMIZEBOX = &H10000
Public Const WS_MINIMIZEBOX = &H20000
Hope this one can help.
This API Codes will help you to remove the maximize button in form.
Public Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const WS_MAXIMIZEBOX = &H10000
Public Const WS_MINIMIZEBOX = &H20000
Hope this one can help.
How to Center a Form
Try this code. Hope it can help.
In your module copy then paste this code:
Public Sub CenterForm(f As Form, w)
f.Left = (w.ScaleWidth - f.Width) / 2
f.Top = (w.ScaleHeight - f.Height) / 2
End Sub
In your Form Load:
Private Sub Form_Load()
CenterForm Me, Main
End Sub
This code will centering your form in mdiparent
In your module copy then paste this code:
Public Sub CenterForm(f As Form, w)
f.Left = (w.ScaleWidth - f.Width) / 2
f.Top = (w.ScaleHeight - f.Height) / 2
End Sub
In your Form Load:
Private Sub Form_Load()
CenterForm Me, Main
End Sub
This code will centering your form in mdiparent
User System Login
Hi.
Sample code in System Login. And theres a 3 attempt to log.
Set rs = BASACONN(connstr, "select * from usersettings where username=txtuser and password=txtpassword")
If rs.EOF Then
MsgBox "Invalid Username/Password. Please Try again", vbExclamation, "Invalid"txtusername.SetFocus
txtcount.Text = Val(txtcount.Text) + 1
'''wrong password
If Val(txtcount.Text) > 2 Then
MsgBox "You have 3 Invalid Input of Username/Password. This Program will terminate",vbCritical, "Exit Program"
End
End If
''end
Else
Unload Me
Main.Show
Endif
Sample code in System Login. And theres a 3 attempt to log.
Set rs = BASACONN(connstr, "select * from usersettings where username=txtuser and password=txtpassword")
If rs.EOF Then
MsgBox "Invalid Username/Password. Please Try again", vbExclamation, "Invalid"txtusername.SetFocus
txtcount.Text = Val(txtcount.Text) + 1
'''wrong password
If Val(txtcount.Text) > 2 Then
MsgBox "You have 3 Invalid Input of Username/Password. This Program will terminate",vbCritical, "Exit Program"
End
End If
''end
Else
Unload Me
Main.Show
Endif
Subscribe to:
Posts (Atom)