Datagrid to ADODC and in your Database Visual Basic

Connect the Datagrid to ADODC and in your Database Visual Basic

Step 1: Click the Datagrid and in the properties please find Datasource and type the name of your ADODC.





Step 2: Right Click the ADODC then you will see the Property Pages. After that Click Build to connect into database.






Step 3: Click the Microsoft Jet 4.0 OLE DB Provider and then Next.




Step 4: Click the Connection and then as you can see the small red circle is the next to click then show the select access database.








View Datagrid Tools In Visual Basic

How to View Datagrid Tools In Visual Basic 

Step 1: Click Project and then select Components or (Ctrl T)




















Step 2: As you can see the components, Check the Microsoft ADO Data Control 6.0(OLEDB) and the  Microsoft Datagrid Control 6.0(OLEDB) then apply or ok.



















Finally Like this:



Create a Main Menu in Visual Basic

This tutorial demonstrates how to build MENUS in Visual Basic programs.


EXAMPLE 1:

End result of this will be a form containing a menu with two top-level items(File and Help).

File menu, shown below, will have the following level-two items below it: NewOpenSaveSave AsPrint, andExit. Note that separator bars appear above the Save, Print, and Exit items.











The Help menu contains just one level-two item below it, About:












To build a menu for use with your Visual Basic program, you use the Menu Editor, which appears as an icon in the toolbar of the VB IDE. It is the circled item in the screen shot below:









Alternatively, you can invoke the Menu Editor from the Tools menu item as shown below:




Visual Basic Simple Login Connected To Database

Visual Basic 6.0 Simple Login Connected to Database














Login Code:


Dim ctr As Integer

Private Sub CmdLogin_Click()
Static ctr As Integer

    Set rs = MySQL("SELECT * FROM  tblUserAccount")

    If txtUsername.Text = rs!username And txtPassword.Text = rs!Password Then
        
        MsgBox "WELCOME ADMIN USER", vbInformation
        frmMain.Show vbModal
    
    Else
        MsgBox "NOT valid Username/Password", vbCritical
        txtUsername.Text = ""
        txtPassword.Text = ""
        txtUsername.SetFocus
        ctr = ctr + 1
        

End If
    If ctr = 3 Then
       
    MsgBox "You have attempted to Login 3 Times in the system. " & _
                        "Please call Programmer for Assistance " _
                        , vbCritical, "Warning Information"
    
    Unload Me
    
    End If

End Sub

Cancel Code:


Private Sub CmdCancel_Click()
Unload Me
End Sub



Create your DATABASE:Like This and save it by (jams)


Create a Module: Just Copy Paste This


Public rs As New ADODB.Recordset
Public Function MySQL(SQL As String) As ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Provider = "Microsoft.JEt.Oledb.4.0"
conn.ConnectionString = App.Path + "\Database\jams.mdb"
conn.Open
Set MySQL = New ADODB.Recordset
MySQL.LockType = adLockOptimistic
MySQL.CursorType = adOpenKeyset
MySQL.Open SQL, conn
End Function