Visual Basic Codes

deegopower

Well-known member
  • Oct 8, 2006
    3,188
    29
    48
    Kandy, Sri Lanka
    SQL Search Using ADO data control..modify the fileds as neccessary.......
    im sleepy........typed it now no bugs working alright......
    DAtabse = Book.db


    Private Sub Command1_Click()
    Text1.Text = ""
    Adodc1.RecordSource = "SELECT * FROM Authors WHERE Author LIKE '" & Text1.Text & "%'"
    Adodc1.Refresh
    End Sub

    Private Sub Text1_Change()
    Adodc1.RecordSource = "SELECT * FROM Authors WHERE Author LIKE '" & Text1.Text & "%'"
    Adodc1.Refresh
    End Sub
     
    Last edited:

    deegopower

    Well-known member
  • Oct 8, 2006
    3,188
    29
    48
    Kandy, Sri Lanka
    Simple calculator......

    Dim n1, n2, ans As Variant
    Dim cal As String
    Private Sub cmdAdd_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Add"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdClear_Click()
    txtDisplay.Text = ""
    n1 = 0
    n2 = 0
    ans = 0
    cal = ""
    End Sub

    Private Sub cmdDivide_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Div"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdEq_Click()
    n2 = txtDisplay.Text
    Select Case cal
    Case "Add"
    ans = n1 + n2
    Case "Subt"
    ans = n1 - n2
    Case "Mul"
    ans = n1 * n2
    Case "Div"
    If n2 = 0 Then
    ans = "Can not divide by Zero"
    Else
    ans = n1 / n2
    End If
    End Select
    txtDisplay.Text = ans



    End Sub

    Private Sub cmdMul_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Mul"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdNo_Click(Index As Integer)

    txtDisplay.Text = txtDisplay.Text + cmdNo(Index).Caption

    End Sub

    Private Sub CMDOFF_Click()
    End
    End Sub

    Private Sub cmdSub_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Subt"
    txtDisplay.Text = ""
    End Sub
     

    Kasun k

    Well-known member
  • Mar 11, 2009
    10,357
    492
    83
    United States
    SQL Search Using ADO data control..modify the fileds as neccessary.......
    im sleepy........typed it now no bugs working alright......
    DAtabse = Book.db


    Private Sub Command1_Click()
    Text1.Text = ""
    Adodc1.RecordSource = "SELECT * FROM Authors WHERE Author LIKE '" & Text1.Text & "%'"
    Adodc1.Refresh
    End Sub

    Private Sub Text1_Change()
    Adodc1.RecordSource = "SELECT * FROM Authors WHERE Author LIKE '" & Text1.Text & "%'"
    Adodc1.Refresh
    End Sub



    Kelinma SQL DB akakin data ganna hadapu prugrams nadda??? data display karanna , edit karanna???? man use karanne SQL server 2005
     
    Nov 24, 2008
    14,813
    575
    0
    78
    Simple calculator......

    Dim n1, n2, ans As Variant
    Dim cal As String
    Private Sub cmdAdd_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Add"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdClear_Click()
    txtDisplay.Text = ""
    n1 = 0
    n2 = 0
    ans = 0
    cal = ""
    End Sub

    Private Sub cmdDivide_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Div"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdEq_Click()
    n2 = txtDisplay.Text
    Select Case cal
    Case "Add"
    ans = n1 + n2
    Case "Subt"
    ans = n1 - n2
    Case "Mul"
    ans = n1 * n2
    Case "Div"
    If n2 = 0 Then
    ans = "Can not divide by Zero"
    Else
    ans = n1 / n2
    End If
    End Select
    txtDisplay.Text = ans



    End Sub

    Private Sub cmdMul_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Mul"
    txtDisplay.Text = ""
    End Sub

    Private Sub cmdNo_Click(Index As Integer)

    txtDisplay.Text = txtDisplay.Text + cmdNo(Index).Caption

    End Sub

    Private Sub CMDOFF_Click()
    End
    End Sub

    Private Sub cmdSub_Click()
    n1 = Val(txtDisplay.Text)
    cal = "Subt"
    txtDisplay.Text = ""
    End Sub


    Oya Thiyenne..... Elakiri Wageeeeee
    Come on Broooo.....
    keep it Up
     

    deegopower

    Well-known member
  • Oct 8, 2006
    3,188
    29
    48
    Kandy, Sri Lanka
    Simple Clock.....
    Write codes to a timer with refresh interval less than 500ms....

    Private Sub Command1_Click()
    End
    End Sub

    Private Sub Timer1_Timer()
    Label4.Caption = Time
    Label5.Caption = Date
     

    deegopower

    Well-known member
  • Oct 8, 2006
    3,188
    29
    48
    Kandy, Sri Lanka
    Kata hari Oneda Start Btn Eka Rename Karannaaaaa.......
    Onna ganna.....
    meka DOS walin karanna puluwan explorer.exe eka edit karalath

    Private Const WM_SETTEXT = &HC
    Private Const WM_GETTEXT = &HD
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

    Public Sub SetStartCaption(str As String)
    Dim StartBar As Long
    Dim StartBarText As Long
    Dim sCaption As String
    StartBar = FindWindow("Shell_TrayWnd", vbNullString)
    StartBarText = FindWindowEx(StartBar, 0&, "button", vbNullString)
    sCaption = Left(str, 5)
    SendMessageSTRING StartBarText, WM_SETTEXT, 256, sCaption
    Exit Sub
    End Sub
     
    Nov 24, 2008
    14,813
    575
    0
    78
    Onna ganna.....
    meka DOS walin karanna puluwan explorer.exe eka edit karalath

    Private Const WM_SETTEXT = &HC
    Private Const WM_GETTEXT = &HD
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

    Public Sub SetStartCaption(str As String)
    Dim StartBar As Long
    Dim StartBarText As Long
    Dim sCaption As String
    StartBar = FindWindow("Shell_TrayWnd", vbNullString)
    StartBarText = FindWindowEx(StartBar, 0&, "button", vbNullString)
    sCaption = Left(str, 5)
    SendMessageSTRING StartBarText, WM_SETTEXT, 256, sCaption
    Exit Sub
    End Sub



    Tnx Bro.... But This Is My Code.................

    Start Btn Rename

    Form Code


    Dim jeff As String
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    Private Const WM_SETTEXT = &HC


    Private Sub Command1_Click()

    jeff = "Lukcy" '(Any Name Do You Want)
    Dim tWnd As Long, bWnd As Long
    tWnd = FindWindow("Shell_TrayWnd", vbNullString)
    bWnd = FindWindowEx(tWnd, ByVal 0&, "BUTTON", vbNullString)
    SendMessage bWnd, WM_SETTEXT, &O0, jeff

    End Sub