Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 01-27-2021, 04:56 PM
Stephen is offline Stephen
Stephen's Avatar
Administrator

Join Date: Dec 2001
Location: Memphis, TN
Posts: 1,602

Send a message via ICQ to Stephen Send a message via AIM to Stephen Send a message via Yahoo to Stephen
Very interesting, I wish you luck with your project. That is way out of my lane in regards to experience but I am sure some others here would be a good fit.
__________________



"If the whole universe has no meaning, we should never have found out that it has no meaning: just as, if there were no light in the universe and therefore no creatures with eyes, we should never know it was dark. Dark would be without meaning."
-- C.S. Lewis
Reply With Quote
  #3  
Old 01-28-2021, 08:09 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

Unfortunately I don't know much VB. Any reason you decided to go with VB instead of something like c#?

I think selecting the entire user database and looping through it is going to be a problem if you have many users. I also don't see if you're assigning a unique userid that isn't the username/email to the profile.

You're query could look something like this:
Code:
SELECT * FROM users WHERE username='new username' AND userid != 'current userid'
If that query comes back positive, the username requested is already assigned to another user.

For whatever reason, the comparison operators in VB don't compute in my head but I think the username compare line needs to be something like this:
Code:
If datareader(1).ToString = txtUsername.Text And Not My.Settings.Username = datareader(1).ToString Then
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #4  
Old 01-29-2021, 01:17 AM
~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~
Quote:
Originally Posted by Scott View Post
Unfortunately I don't know much VB. Any reason you decided to go with VB instead of something like c#?
I only went that way as the tutorial was written in VB
Should i be looking to change it all over to C#?
Reply With Quote
  #5  
Old 01-29-2021, 02:56 AM
~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~
Ok found another tutorial in C#
i will put it together and see how i go with this one and get back to you. :P
Reply With Quote
  #6  
Old 01-30-2021, 09:15 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

I would use something more widely supported and modern like c# but it's totally up to you.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #7  
Old 01-30-2021, 10:43 AM
--BulletMagnet-- is offline --BulletMagnet--
--BulletMagnet--'s Avatar
DF2 Forever

Join Date: Jun 2005
Location: USA
Posts: 718

Send a message via MSN to --BulletMagnet--
C# is superior in every way. MS is phasing out VB.
Reply With Quote
  #8  
Old 01-31-2021, 03:38 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~
Thanks for the feedback.....
I see most VB tuts are old and outdated but i thought it might be the way to go.

I have started to redo it in C#
The Registration and Login are done as is the DB info.

I'm still learning so I'm expecting to hit walls and have issues.
Next i will setup a chat page and see if i can send a message.
Attached Images
File Type: jpg login.jpg (28.9 KB, 11 views)
Reply With Quote
  #9  
Old 02-03-2021, 01:24 AM
~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~
Well I'm starting to get somewhere with it, here is a short clip of what i have so far...

I managed to do the reg, login, change the font size color and background
I'm trying to figure a few thing out but a few more hours of searching and i hope to sort them out

It has a long ways to go but for someone without knowledge of coding or prier learning i think I'm doing ok



I do have a question if anyone might know...
I want to add a unique member id number starting a 1000000, so e.g.
Scott is the user, membership id is 1000468.
Users can search for id number to find user and add as a friend

p.s. sorry for the crap recording, i just grabbed the first thing that records and made a quick clip, i will make a better one later as i progress

Last edited by ~BLÃÐE~; 02-03-2021 at 03:54 AM.
Reply With Quote
  #10  
Old 02-03-2021, 08:02 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

Nice work blade!

If you're using a MySQL database you can start the auto_increment field at 100000000 (make sure it's an unsigned int field). When creating a new account, once you insert the user you can use LAST_INSERT_ID() on the table to find the last id you inserted so you can display it to the user.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #11  
Old 03-21-2021, 12:12 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
Looking good!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:33 PM.




Powered by vBulletin®