A Reminder Alerter

Posted in Math/Dates with tags , , on April 8, 2010 by sniffervb

Can not remember the important things in the busy schedule? This code remembers the date and time set by you from a popup window will be on top of all running applications. You can reschedule reminders. Can mark as pending or a fact. Way to control all the reminders that are not shown above bcoz this application is not running at that moment When you close it (X), then it will be in the system tray.

A Simple Database

Posted in Database with tags , , on March 28, 2010 by sniffervb

‘First, for those of you who have never used database with your applications
‘first, please take a point of going to the menu of the project, and clicking on
‘references. Here you will notice that one of the references is “Microsoft
‘DAO Object Library. “This is the element that is required to access the
‘Database.

‘Right,, Let’s Start The Example.

‘First, we need some variables dim
‘Beginning with the variable DB. This variable simply tells VB which database
‘We intend to work from
Db As Database
‘Next, we have the variable RS. This tells VB that recordset, or a table inside
‘the database that we intend to work from
Rs As Recordset
‘The VB was variable tells the workspace. Sorry, but im not entirely sure what this
‘actually does, but I know it is essential to the work project
Dim was As Workspace
‘The variable will eventually contain the maximum number of records in the database
‘table so that we can use the variable as a loop control variable
Max As Long
‘The variable i is just another variable loop control
Dim i As Long
‘This variable is used to store any responses to message boxes
Dim errormsg
‘These two variables are here so we know if we want to add new data to
‘database, or edit existing data
As Boolean Dim dbadd
DBEdit As Boolean

‘Well, now that we’ve declared our variables, we can begin the actual
encoding scheme ‘
Private Sub Form_Load ()
‘The first thing we do when the form loads
‘VB is to say that we are going to work from table
Set was = DBEngine.Workspaces (0)

‘Here you set the database. This will tell VB to use the database called
‘ “Database” which is in the same directory as this project.
‘Of course, not always to maintain the database in the same directory,
‘, But I find that helps!
Set db = ws.OpenDatabase (App.Path & “\ Database.mdb”)

‘Here we set the table within the database that you will use.
‘As we have only one table in our database, this is fairly easy.
Set rs = db.OpenRecordset ( “tbldata” dbOpenTable)

‘Next, call the function list, which will have some of
‘Information outside of the database, and insert it in the list box
list

End Sub

Private Function list ()
‘This function surnames extracted from the database, and
‘Put them in the list box for selection

‘If there are no records in the database table, so we can extract
‘all the data, so we have to exit the function. If we do this, then
‘The program will throw an error and crash
If rs.RecordCount = 0 Then
errormsg = MsgBox ( “No records found”,, “Error”)
‘If no records are found, then it is very likely that the user
‘is using the search field, so we set the text box back to what
‘was before the error came
If Len (txtSearch.Text)> 0 Then
txtSearch.Text = Mid (txtSearch.Text, 1, Len (txtSearch.Text) – 1)
Other
Exit Function
End If
End If
‘Move to first record in the database
rs.MoveLast
‘Move to the last record in the database
rs.MoveFirst
‘You’re probably wondering why I just moved to the first, and then
‘the last record in the database. Well, I find that access does not report
‘the number of records in the table accurately. I have no idea why. E ‘a
‘what microsoft. However, going to the end, the first record and then usually
‘allows access to the report the exact number of records
‘Next, we need to set the variable “Max” to the number of records in the database
max = rs.RecordCount
‘Now we must return to the first record in the database
rs.MoveFirst
‘Now we need to clear our box, so that we do not have the data repeated
lstdata.Clear
‘Now we can start a cycle, which in turn extract the data from each of
‘record in the database
For i = 1 to max
‘For each item, we want to put the name in the list box
‘rs ( “Name”) simply tells VB to get the data from the field name
lstdata.AddItem rs ( “name”)
‘Then we need to go to the next record in the table
rs.MoveNext
‘repeat the cycle
Next i

End Function

Private Sub lstdata_Click ()
‘Once all our surnames are in the list box, we need to control what happens
‘when the user clicks on one of surnames
‘The line below will send a SQL command to the database, which tells Access
‘to create a theoretical new table, which contains only information about
‘the name selected. This works exactly the same way to do a search in
‘database to show only the data on a person with a certain surname
Set rs = db.OpenRecordset ( “Select * from tbldata where name = ‘” & Trim (lstdata.list (lstdata.ListIndex)) & “‘”)
‘move to first record in the table
rs.MoveFirst
‘Come on, we need to extract information from databases, and put
‘it in the text boxes relevant
txtForename.Text = rs ( “name”)
txtSurname.Text = rs ( “Name”)
txtPhone.Text = rs ( “phone_no”)
‘Now we need to activate some of the control buttons so that we can work on
‘Data
cmdEdit.Enabled = True
cmdDelete.Enabled = True

End Sub

Private Sub cmdDelete_Click ()
‘Now we look at one of the most simple database, deleting data
‘First, we will launch an error message to make sure that you want
‘delete the data, because after you delete the data, there is
‘Back
errormsg = MsgBox ( “Are you sure you want to delete this record”, vbYesNo, “Delete Record”)
‘If you said yes, we are able to erase data
If vbYes Then errormsg =
‘Delete data
rs.Delete
‘Now we have to set the recordset back to all records in the table, rather than one
‘We just deleted
Set rs = db.OpenRecordset ( “tbldata” dbOpenTable)
‘Next we need to call the function list to relist all the data, not including
‘record we just deleted
list
‘Now we need to set the command buttons and text boxes back to their original state
txtSurname.Text = vbNullString
txtSurname.Enabled = False
txtForename.Text = vbNullString
txtForename.Enabled = False
txtPhone.Text = vbNullString
txtPhone.Enabled = False
txtSearch.Text = vbNullString
‘then we need to set the command buttons back to their original state
cmdSave.Enabled = False
cmdcancel.Enabled = False
cmdAdd.Enabled = True

Other
‘If the user presses then we just exit routine sub -
Exit Sub
End If

End Sub

Private Sub cmdAdd_Click ()
‘When the Add button is pressed, we will first need to clear all
‘text box
txtSurname.Text = vbNullString
txtForename.Text = vbNullString
txtPhone.Text = vbNullString
‘Now we need to activate the text boxes so that the user can enter data
txtSurname.Enabled = True
txtForename.Enabled = True
txtPhone.Enabled = True
‘We also need to disable all command buttons, so that the user can not
‘click on one of them and confuse the program
cmdAdd.Enabled = False
cmdDelete.Enabled = False
cmdEdit.Enabled = False
cmdend.Enabled = False
‘It allowed to save and delete buttons so the user can save the
‘New data
cmdSave.Enabled = True
cmdcancel.Enabled = True
‘Now we set dbadd = true so that VB knows what we’re trying to do
dbadd = True
End Sub

Private Sub cmdsave_Click ()
‘When the user has finished adding the new data, they click
‘Save button to save the data to the database
‘We need to decide at this point whether the user is entering new data
‘or modification of existing data already held within the database
‘This is what we used the variables and dbadd DBEdit.
If dbadd = True Then
Call add
ElseIf DBEdit = True Then
Call change
End If
End Sub

‘This is the function that we use to add new data
Public Function Add ()
‘The first thing we must do is make sure the user has entered all the data
‘as some databases are designed so that no area may contain a null value
‘To do this, we need only check that the text boxes have all the information in their
‘If you havent, you will launch an error message and block the function of
If txtSurname.Text = vbNullString Or _
txtForename.Text = vbNullString Or _
txtPhone.Text = vbNullString Then
errormsg = MsgBox ( “All fields should contain data”, vbCritical, “Error”)
Exit Function
End If

‘Now we need to tell the database that we intend to add data to the database
rs.AddNew
‘then we need to add the data in the required fields in the database
rs ( “Surname”) = txtSurname.Text
rs ( “Name”) = txtForename.Text
rs ( “phone_no”) = txtPhone.Text
‘then we need to update the database so that we can display data
rs.Update
‘Now we can overshadow all text fields
txtSurname.Text = vbNullString
txtSurname.Enabled = False
txtForename.Text = vbNullString
txtForename.Enabled = False
txtPhone.Text = vbNullString
txtPhone.Enabled = False
txtSearch.Text = vbNullString
‘then we need to set the command buttons back to their original state
cmdSave.Enabled = False
cmdcancel.Enabled = False
cmdAdd.Enabled = True
cmdend.Enabled = True
‘Now we need to call the function list so that our new name appears
‘in our list box
list

End Function

Private Sub cmdEdit_Click ()
‘This function will be used to modify existing data within the database
‘We need to activate the text boxes so that the user can change
txtSurname.Enabled = True
txtForename.Enabled = True
txtPhone.Enabled = True
‘We also need to disable all command buttons, so that the user can not
‘click on one of them and confuse the program
cmdAdd.Enabled = False
cmdDelete.Enabled = False
cmdEdit.Enabled = False
cmdend.Enabled = False
‘It allowed to save and delete buttons so the user can save the
‘modified data
cmdSave.Enabled = True
cmdcancel.Enabled = True
‘Now that we have set DBEdit = true so that VB knows what we’re trying to do
DBEdit = True

End Sub

Public function edit ()
‘This is the function that we use to change the database
‘The first thing we must do is ensure that the user has entered all the data
‘as some databases are designed so that no area may contain a null value
‘For this, we need only check that the text boxes have all the information in their
‘If you havent, you will launch an error message and block the function of
If txtSurname.Text = vbNullString Or _
txtForename.Text = vbNullString Or _
txtPhone.Text = vbNullString Then
errormsg = MsgBox ( “All fields must contain data”, vbCritical, “Error”)
Exit Function
End If

‘Now we need to tell the database that we intend to change the existing
‘in database
rs.edit
‘then we need to add the modified data in all required fields in the database
rs ( “Surname”) = txtSurname.Text
rs ( “Name”) = txtForename.Text
rs ( “phone_no”) = txtPhone.Text
‘then we need to update the database so that we can display data
rs.Update
‘Now we can overshadow all text fields
txtSurname.Text = vbNullString
txtSurname.Enabled = False
txtForename.Text = vbNullString
txtForename.Enabled = False
txtPhone.Text = vbNullString
txtPhone.Enabled = False
txtSearch.Text = vbNullString
‘then we need to set the command buttons back to their original state
cmdSave.Enabled = False
cmdcancel.Enabled = False
cmdAdd.Enabled = True
cmdend.Enabled = True
‘Next, we will need to set the recordset for the entire table, not just
‘what we have changed
Set rs = db.OpenRecordset ( “tbldata” dbOpenTable)
‘Now we need to call the function list so that our new name appears
‘in our list box
list

End Function

Private Sub cmdcancel_Click ()
‘If you change your mind about how to change or add data, we need to set the
‘form to its original state
txtSurname.Text = vbNullString
txtSurname.Enabled = False
txtForename.Text = vbNullString
txtForename.Enabled = False
txtPhone.Text = vbNullString
txtPhone.Enabled = False
txtSearch.Text = vbNullString
‘then we need to set the command buttons back to their original state
cmdSave.Enabled = False
cmdcancel.Enabled = False
cmdAdd.Enabled = True
cmdend.Enabled = True
‘Next, we will need to set the recordset back to the entire table, rather than
‘only the last name selected
Set rs = db.OpenRecordset ( “tbldata” dbOpenTable)
‘Now we need to call the function list so that our new name appears
‘in our list box
list

End Sub

Private Sub txtSearch_Change ()
‘This is a nice little feature’ that will allow the user to search a surname
‘in the database. Most modern databases are very large, and so allow the user
‘to enter the first letters of the name you want, in order to limit the
‘selection.
‘If the research presented does not contain any text, then we must tell VB to read
‘the whole recordset
If txtSearch.Text = vbNullString Then
Set rs = db.OpenRecordset ( “tbldata” dbOpenTable)
‘If the search field contains the text, then we need to tell VB to search for names
‘begin with the letters entered in the search
Other
Set rs = db.OpenRecordset ( “SELECT * FROM tbldata WHERE Name LIKE ‘” & txtSearch.Text & “‘” & “&’*'”)
End If
‘then we need to repopulate the list box with only the last names that begin with
‘the letters in the search
list

End Sub

Private Sub cmdend_Click ()
‘The final code we need is the EXIT button to terminate the program
‘close the database, just so that we can close everything clean
db.Close
End

Data Basis

Posted in Complete Applications with tags , , on March 28, 2010 by sniffervb

This source code is to register or maintenance of employer, selling or goods stock.

ADO Connection

Posted in Coding Standards with tags , , on March 28, 2010 by sniffervb

Here is the code to connect your visual basic 6 program to Microsoft Access Database

Reference ADO

For Microsoft Access Database

Private DB as New Connection

With DB

.Provider=”Microsoft.jet.oledb.4.0″ (Access 2000)

.ConnectionString = “c:\Test.mdb”

.Open

End with

For Microsoft SQL Database

With DB

.ConnectionTimeout = 60

.Open “Driver={SQL Server};Server=srv_za_database;Uid=Admin;Pwd=test;Database=test”

End With

Both uses ADO Connection

Students Registration

Posted in Complete Applications with tags , , , on March 28, 2010 by sniffervb

A complete students registration for schools

 

Analog Clock and Timer

Posted in Math/Dates with tags , , , on March 28, 2010 by sniffervb

Clock designed with circles only. Rotating the inside. timer executer something after the time specified. must see for some Cool Graphics routines and the extension for the timer control standards.

 

Animate Text on a form

Posted in Coding Standards with tags , , on March 28, 2010 by sniffervb

To show how to display animated text on a form

 

Choose Project

Posted in User Interface with tags , , on March 27, 2010 by sniffervb

Visual Basic 6 is one of the tools for application development a great demand by people. Here Visual Basic 6 offers in making the application and can use components provided. To start the Visual Basic 6 you need to install the Visual Basic 6.0. This program is usually in one package with Visual Studio 6.0. By using Visual Basic 6 we can produce a variety kinds of programs. Of applications that integrate databases, networks, office automation, and web application. Here we will speak basics Visual Basic programming with a little about the database. In the initial screen display will appear as above. Visual Basic provides many types of application modules. To start the program choose the default Standard EXE, then click the Open button. After that will appear like the following view. Now we will recognize the parts of the IDE (Integrated Development Environment) that we use.

Interface

Posted in User Interface with tags , on March 27, 2010 by sniffervb

Form designer
This form is where we are to design a user interface (interface design).
Code View
This is a place to put the source code. press F7 to display or click the icon.
View object
This is virtually identical to the form designer, just a difference if we are in Code view and the view to return to the form designer. to show you can squeeze pimples on the face of you, xixixi … squeeze could also iconnya or by pressing Shift + F7.
Toolbar
This menu is the menu on the standard on windows, its function is also similar to other programs.
Toolbox
This is where the components to design a user interface in which each component has the characteristics and functions of different.
Project Explorer
This is your project structure in which contain one or more forms.
Properties
This is a column to display the properties of the components are active, in which the characteristics of a current component. You can adjust the components through this column.

Access Database Opener

Posted in Database with tags , , , on March 28, 2010 by sniffervb

This project is a knife that opens the database, virtually any database MSAccess w / o knowing the password. The main purpose of the program is to open a passworded database, and retrieve the password. This is useful for databases with password forgotten. The program requires an “Set” – this is where the program retrieves several combination to unlock the password. If you suspect that the database to include numbers and special characters simply include them in the character set. The program works perfectly on high-end machines, but its use on low end machines take a while.

 

A very flexible Access Database Editor for Records

Posted in Database with tags , , , , , , , on March 28, 2010 by sniffervb

Opens MSAccess 97 and 2000, working with databases with passwords. allows the user to add, edit, delete, edit records from an Access database, also added Defrag database function.

 

LED Digital Clock

Posted in Miscellaneous with tags , , , , on March 28, 2010 by sniffervb

Small nice Digital Clock that remembers its last position

 

Raining Letters

Posted in Miscellaneous with tags , , , on March 28, 2010 by sniffervb

A nice Text effect. Letters falling down hitting the ground and being catapulted up again.
I tried to comment as much as possible.

 

ADO Primer

Posted in Database with tags , , on March 28, 2010 by sniffervb

You have reached a stage where you realize that the standard ADO data control supplied with VB is not enough for you? Ever wondered how you can connect to a database with the code? As you can read, write, delete, edit the data in tables?
Well, here is a small application that uses ADO code to manipulate data in a table.
I’ve also included the code to enable or disable the command buttons in the window according to the context (exampling To disable the First & previous buttons when in the first record …).

 

New Professional Form Animation

Posted in Graphics with tags , , , , on March 28, 2010 by sniffervb

This is a new form of animation idea I did yesterday.The effect is more professional than others, many ‘New’ is that the function can automatically detect the position of ‘controls, which calls the’ Form Load ‘form orginates this check same. The code is not so huge and the animation runs smoothly. One More – when you execute exe compiled orginates from ‘your Icon’. You can also select the color animation. I hope you all like it. Enjoy!.

 

Random File Access Program

Posted in Database with tags , , , , on March 28, 2010 by sniffervb

In no case is this a complete application, however, now has the appearance of an environment of Access … MDI look and feel (just beginning). Adding validation routine more, the login prompt (using readings from an ini / config file), toolbars, menu bars, ProgressBar, and the search function. Great for beginners and intermediates may help some. N. ODBC or ODBC bridge necessary. Only a simple text file using the old random access. Again, this is not a complete application.

 

Drop Text Shadow

Posted in Coding Standards with tags , , on March 28, 2010 by sniffervb

No need to explain…..

 

Learn Anything About VB

Posted in Coding Standards with tags , , on March 28, 2010 by sniffervb

Learn anything you want about Visual Basic. Really a  complete program!

 

Follow

Get every new post delivered to your Inbox.