:::Instructions to Create search engine from Visual Basic 6/2008/2010/2013 for free:::
[ If you like to help us / you can join with us please redirect your application to my email(supunmalabe@gmail.com). I am glad to have a designer. Thank you.]
1.
- Load the Visual Basic environment from your computer by clicking "Start>Programs>Microsoft Visual Studio 6.0>Microsoft Visual Basic 6.0".
- Select "Standard EXE" from the "New Project" dialog box that pops up. Click "Open" button to proceed.
- Drag and drop controls from the "Toolbox" into the form to design the interface and set the individual properties afterward under the "Properties" window. A search form usually has text boxes where users type words to search against the database, labels, some command buttons, grid to display the result, and database control that links the form into the table within the database. Continue with designing the form as preferred.
- Click "View>Code" from the menu to go to the code section. This is where you will write the source codes for your project.
- Go to "Form_Load" event by clicking the appropriate event name from the drop-down boxes in the codes section. Input a code similar to the one below. This code will set the connection properties of your data control and connects the grid to the database file.
With
Adodc1
.ConnectionString = "[Type your connection string here]"
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CommandType = adCmdTable
.RecordSource = "[Type the name of a table or query here]"
.Refresh
End With
.ConnectionString = "[Type your connection string here]"
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CommandType = adCmdTable
.RecordSource = "[Type the name of a table or query here]"
.Refresh
End With
With
Grid1
Set .DataSource = Adodc1
.HighLight = flexHighlightWithFocus
.ColWidth(0) = .ColWidth(0) + 1000 'this is sample column dimension; change as preferred
.ColWidth(1) = .ColWidth(1) + 1800
.ColWidth(2) = .ColWidth(2) + 1800
.ColWidth(3) = .ColWidth(3) + 2300
.Refresh
.TabIndex = 0
End With
Set .DataSource = Adodc1
.HighLight = flexHighlightWithFocus
.ColWidth(0) = .ColWidth(0) + 1000 'this is sample column dimension; change as preferred
.ColWidth(1) = .ColWidth(1) + 1800
.ColWidth(2) = .ColWidth(2) + 1800
.ColWidth(3) = .ColWidth(3) + 2300
.Refresh
.TabIndex = 0
End With
- Double-click the text box where the user will enter the search criteria. For example, the user wants to search certain last names from the database and he will type the letters into the search box. When matches are found, the records will be displayed on the grid. In the code section, go to "Text1_Change()" event and input a code similar to the following:
Dim
t as String
If
Text1.Text <> "" Then
If Adodc1.Recordset.RecordCount <> 0 Then
t = "*" + Text1.Text+ "*"
Adodc1.Recordset.Filter = "LastName like '" + t + "'"
End If
Else
Adodc1.Recordset.Filter = adFilterNone
End If
If Adodc1.Recordset.RecordCount <> 0 Then
t = "*" + Text1.Text+ "*"
Adodc1.Recordset.Filter = "LastName like '" + t + "'"
End If
Else
Adodc1.Recordset.Filter = adFilterNone
End If
- Press the "F5" key to run the project. Test the program and check if it's running as it should.
- Save the project by clicking "File>Save Project As" from the menu and providing a descriptive filename.
Category:-Education
Note:-If you have any error or if you fail to do this project please don't hesitate to report us. In reporting please send your source codes to our email withing a ZIP format. Thank you.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment