hi there experts!!!im a new member in this site and i want to know certain thing about vb:
code of:
1.creating new password
2. adding new user
3. editing password
4. editing username

i know this is very simple for you guys i hope you can help me on this coz im just a starter in vb:) thanks

seeker:mrgreen:

you first have to learn how to interact with a database through VB. The DB could be as simple as a text file or very complex such as MS Access or SQL Server.

As for the db code, create a menu on the main form for those three options you posted. Options 1 and 2 can be combined because you can only create a new user by adding a new password. As for option 4 -- edit user name -- that is normally not allowed because the user name is a unique key field in the database. To edit user name you normally have to delete the current user and recreate it with the new name as a new user.

1. use: RecordsetName.Addnew
then save by using: RecordsetName.Update
2.same as above
3. just bind the textboxes into their corresponding Fields inside your Database everytime you click the edit button.
4. Same as No.3

thank you very much ...hope i can do it ..

hi there!!for example i have these kind of forms:


UserName: __Textbox__
Current Password: _textbox__

enter new password: __textbox__
Re-enter password: __textbox__

_OK_ _CLEAR_ __SAVE__ __EXIT__ (Command button)

i have already set the DB file, the username and password, how can i run this??can you give me a sample code??
thank you very much=)

hi there!!for example i have these kind of forms:


UserName: __Textbox__
Current Password: _textbox__

enter new password: __textbox__
Re-enter password: __textbox__

_OK_ _CLEAR_ __SAVE__ __EXIT__ (Command button)

i have already set the DB file, the username and password, how can i run this??can you give me a sample code??
thank you very much=)

How about something simple like (this code is not tested, use it just as a sample)

Your form structure:

Username: [textbox]
Password: [textbox]

[ login(button) ] [ cancel (button) ]

Private Sub Login_Click()

    Dim conn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    
    Dim user As String
    Dim password As String
    
    user = txt_username.Text    'pull data from txt box
    password = txt_password.Text    'pull data from txt box
    
    conn.Open "your_database_connection_string"
    rs.Open "select * from your_login_table"
    
    'make sure rs is not empty
    If rs.BOF = False Then
        While rs.EOF = False
            If user = rs.Fields("Column_Name_For_Username") And _
                password = rs.Fields("Column_Name_For_Password") Then
                MsgBox "Validation successful"
                Exit Sub
            End If
            rs.MoveNext
        Wend
        
        MsgBox "No such user exists"
    Else
        MsgBox "The recordset is empty", vbCritical
    End If
        
End Sub

thank you very much, this will help me a lot...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.