Release a small software for everyone to play

Source: Internet
Author: User
Although VB
Dead .. However, it is quite good to write small desktop software. But I gave it back to my teacher .. I forgot about it ..~~~~~~~~~~


I wrote it a long time ago using VB... Just a few lines of code .... No technical skills
Download not required
.. Run it directly ..
:

:
Http://www.blogjava.net/Files/wujun/mysoft.rar

Key code:
Link database:

Public Function contoserver () function contoserver () as Boolean 'connect to the Database Function
On Error goto conerror
Con. cursorlocation = aduseclient
Con. connectionstring = "provider = Microsoft. Jet. oledb.4.0;" & "Data Source =" & App. Path & "\ dB. mdb ;"
& "Persist Security info = false"
'Con. connectionstring = "provider = Microsoft. Jet. oledb.4.0; Password = wujunainiyiwn; Data Source = E: \ data \ vars. mdb; persist Security info = true"
Con. commandtimeout = 20
Con. Open
Contoserver = true
Exit Function
Conerror:
Msgbox "problem ,! ", Vbexclamation + vbokonly," serious problem"
Contoserver = false
End Function

Public Function closecon () function closecon () as Boolean 'close the Connected Function
On Error resume next
If (not con is nothing) Then con. Close
Set con = nothing
End Function

Public Function runsql () function runsql (byval strsql as string) as Boolean 'function used to execute the query statement
On Error goto runerror
Set rst = nothing
Set rst = new ADODB. recordset
RST. Open strsql, Con, adopendynamic, adlockoptimistic,-1
Runsql = true
Exit Function
Runerror:
Msgbox "An error occurred while running this sentence", vbexclamation + vbokonly, "prompt"
'Msgbox "error no.:" & err. Number & vbcrlf _
& "Error Description:" & err. Description, vbcritical + vbokonly, "connection error"
Runsql = false
End Function

TIPS:

VB hyperlink import button
1. Definition

Private declare function ShellExecute () function ShellExecute lib "shell32.dll" alias "shellexecutea"
(Byval hwnd as long, byval lpoperation as string, byval lpfile as string, byval
Lpparameters as string, byval lpdirectory as string, byval nshowcmd as long) as long

2. Use

ShellExecute me. hwnd, "open", "http://www.blogjava.net/wujun", vbnullstring, vbnullstring, vbnormalfocus

Textbox
Only numbers can be entered:

Private sub text2_keypress () sub text2_keypress (keyascii as integer)
Dim A as Boolean
A = CHR (keyascii) like "[0-9]" or keyascii = 8
If a = false then
Keyascii = 0
Msgbox "here we enter numbers! ", Vbinformation + vbokonly," prompt"
End if
End sub

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.