View Single Post
  #1  
Old 01-27-2021, 04:33 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
Blades Chat Program

Ok so i wanted to make an app/program sort of like ICQ for those that remember it.
A simple chat program made in VB that works off my web hosting service.

I finally found a tutorial sort of like what i wanted.
The guy that did the video has moved on and didn't reply to emails, i found the source code which is slightly different to the video but mostly there with the missing bits, well most of them lol.

I was hoping with help from some of you we might be able to get it working properly, never know might start a new community chat service.

Software: I'm using VB 2017

Video Tutorial: The first 4 mins shows a working version
https://www.youtube.com/watch?v=6mUCZq6pyvo

If anyone is interested in the project i can send a link to all the files.

So far....
I have the app complete but getting lots of little issues, it needs finishing and a little polish.

I can register and login no worries
When i Edit Profile which puts the details in, name, mobile, email, pass change. I get the error user already exists (see code example 1)

Or i changed to another bit of code to do the same thing i get another issue of that users over rights all other users in the DB, so if i had 3 users Bob, Bill, Merry and edited Bob, there would be 3 entries of Bob and no Marry or Bill.
(see code Example 2)


Example 1

Code:
Imports MySql.Data.MySqlClient

Public Class frmEditProfile

    Private Sub frmEditProfile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.Open()

        txtName.Text = My.Settings.FirstName
        txtEmail.Text = My.Settings.Email
        txtMobile.Text = My.Settings.Tel
        txtUsername.Text = My.Settings.Username
    End Sub

    Private Sub btnApply_Click(sender As Object, e As EventArgs) Handles btnApply.Click
        Dim cmdread As New MySqlCommand("SELECT * FROM users", con)
        Dim datareader As MySqlDataReader
        Try
            datareader = cmdread.ExecuteReader
            While datareader.Read()
                If datareader(1).ToString = txtUsername.Text And Not My.Settings.Username = txtUsername.Text Then
                    MsgBox("Username already exists.", MsgBoxStyle.Exclamation, "Username Error")
                    datareader.Close()
                    Exit Sub
                End If
                If datareader(3).ToString = txtEmail.Text And Not My.Settings.Email = txtEmail.Text Then
                    MsgBox("Email already exists.", MsgBoxStyle.Exclamation, "Email Error")
                    datareader.Close()
                    Exit Sub
                End If
                If datareader(6).ToString = txtMobile.Text And Not My.Settings.Tel = txtMobile.Text Then
                    MsgBox("Mobile number already exists.", MsgBoxStyle.Exclamation, "Mobile No. Error")
                    datareader.Close()
                    Exit Sub
                End If
            End While
            datareader.Close()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Database Error")
        End Try
    End Sub

    Private Sub frmEditProfile_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        con.Close()
    End Sub

End Class
Example 2

Code:
Public Class EditProfile
#Region "declare"
    Dim mycmd As New MySqlCommand
    Dim myconnection As New DTConnection
    Dim objreader As MySqlDataReader
#End Region


    Private Sub btnApply_Click(sender As Object, e As EventArgs) Handles btnApply.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "update users set username='" & txtUsername.Text & "',email='" & txtEmail.Text & "',password='" & txtPassword.Text & "', name='" & txtName.Text & "', mobile='" & txtMobile.Text & "' "
        mycmd.ExecuteNonQuery()
        myconnection.close()
        MsgBox("Data changed !!", MsgBoxStyle.Information, "Notice..")

    End Sub

    Private Sub EditProfile_Load(sender As Object, e As EventArgs)
        txtName.Text = My.Settings.FirstName
        txtEmail.Text = My.Settings.Email
        txtMobile.Text = My.Settings.Tel
        txtUsername.Text = My.Settings.Username
    End Sub

    Private Sub EditProfile_Load_1(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class
Reply With Quote