VB.NET TUTORIALS LOGIN ANY JABBER ACCOUNT

VB.NET TUTORIALS: LOGIN NIMBUZZ OR ANY JABBER APPLICATION USING AGSXMPP 




(PART1) Hi Friends,On this topic i Decide to give You an Idea on how to make Your Own Nimbuzz
 Software or any Jabber Application Step by Step (Using Agsxmpp in VB.NET) Requirements: Visual Basic 2010 or hiegher Agsxmpp.dll Net Framework ( Must Better youve Installed all Version ) Now you will have all requirements needed? Now Lets Start. Now Open the VB.NET and selcet New Project




after clicking the new project , You can re-name the software you want,follow the instruction on the photo below
 

then click OK ,now you will see a plain box for your first software. you can resize the form as you want.


Now,about the tools,you can get the tools like,button,textbox,label,richtextbox and more tools you need here.
 

On this tutorials for login jabber account,we will need only :

 3 label
 3 textbox
 2 button
 1 listbox 

 
 for the label1 text,type = Username
 for label2 text type = Password 
 for label3 text type = Resource
 for the 3 textbox, 
 textbox1 rename it to txtuser
 textbox2 rename it to txtpassword 
 textbox3 rename it to txtresource
 now for listbox, rename it to listEvents and
 for the 2 button,1 for login and 1 for logout
 

and now the form look like complete, focus on mouse in the form and rigth click,select view code to add the codes.. first is to put imports. on the top of public class form, looks like this! and you will see i circle the codes they have yelow line and red dot? that showing means you need to add agsxmpp.dll file in reference project.
 

How to add agsxmpp in your project? click project button on the top of your vb.net and select add reference. after click add reference,select browse. and find the agsxmpp.dll file where you save it.
 

after adding agsxmpp.dll, now you will see your codes like this, its mean nothing error.
 
the codes is:

  1.  Imports System 
  2. Imports System.Drawing 
  3. Imports System.Collections
  4.  Imports System.ComponentModel 
  5. Imports System.Windows.Forms 
  6. Imports System.Data 
  7.  Imports agsXMPP 
  8. Imports agsXMPP.protocol
  9. Imports agsXMPP.protocol.iq 
  10. Imports agsXMPP.protocol.iq.disco 
  11. Imports agsXMPP.protocol.iq.roster 
  12. Imports agsXMPP.protocol.client 
  13. Imports agsXMPP.Xml.Dom 

  14.  Now adding other codes, 

  15.  Inherits Form 
  16.  Private reu As New XmppClientConnection() 
  17.  Public Sub New()
  18.  InitializeComponent() Init()

  19.  End Sub 

  20.  Private Sub Init() 
  21.  listEvents.Items.Clear()

  22.  AddHandler reu.OnLogin, New ObjectHandler(AddressOf reu_OnLogin) AddHandler reu.OnAuthError, New XmppElementHandler(AddressOf reu_OnAuthError) 
  23.  AddHandler reu.OnClose, New ObjectHandler(AddressOf reu_OnClose)

  24.  End 

  25. Sub Private Sub reu_OnClose(sender As Object) 
  26.  If InvokeRequired Then BeginInvoke(New ObjectHandler(AddressOf reu_OnClose), New Object() {sender}) 
  27.  Return 
  28.  End If

  29.  listEvents.Items.Add("OnClose Connection closed") 
  30.  listEvents.SelectedIndex = listEvents.Items.Count - 1 

  31.  End Sub

  32.  Private Sub reu_OnAuthError(sender As Object, e As agsXMPP.Xml.Dom.Element) If InvokeRequired Then BeginInvoke(New XmppElementHandler(AddressOf reu_OnAuthError), New Object() {sender, e})
  33.  Return 
  34.  End If 
  35.  listEvents.Items.Add("OnAuthError")
  36.  listEvents.SelectedIndex = listEvents.Items.Count - 1 
  37.  End Sub
  38.  Private Sub reu_OnLogin(sender As Object) If InvokeRequired Then BeginInvoke(New ObjectHandler(AddressOf reu_OnLogin), New Object() {sender}) Return
  39.  End If
  40.  listEvents.Items.Add("OnLogin") listEvents.SelectedIndex = listEvents.Items.Count - 1 
  41.  MsgBox(" Online ", MsgBoxStyle.Information) 
  42.  End Sub 

 add this codes on the Public Class Form below. looks like this.


after add the codes,go to form design and double click the login button and add this codes:
  1.  Dim jidUser As New Jid(txtuser.Text)

  2.  reu.Username = jidUser.User
  3.  reu.Server = jidUser.Server
  4.  reu.Password = txtpassword.Text 
  5.  reu.Resource = txtresource.Text 
  6.  reu.AutoResolveConnectServer = True 
  7.  reu.Open() 

 after adding codes for login button,back to form design and double click the logout button and add this codes: reu.Close() and now your first software is finish.. you can put name of your software here,look on image. click only the application form and go to properties and select text and change what name you want.
 

and now,we will test the software,i will use nimbuzz server and gmail account,but the first thing i forget, in your password textbox,you will need to add some sign to hide the real password leter. see the image on how. in passwordschar i add #



after add hide sign in passwordchar, now test the software, How? they have two way on how to test run the software you made, first,you will see play sign in your vb.net.click that play sign to run your project.


or click debug button in your vb.net and click start debuging.
 

Now we will try your project: first i try to sign in nimbuzz: now you will see my nimbuzz account talentadong-pinoy is offline. then i try to login using the new application. we need type the whole jid (talentadong-pinoy@nimbuzz.com)
 


and now i login succesfuly using nimbuzz

 

now we will try in gmail,also we need add @gmail.com so i put d1mustdie@gmail.com. again i login succesfuly in my gmail account.
 

for building your project, click debug,and select build and click, after succesfully build your project,then close the vb.net,sometimes we will to save or not when you close the vb.net.so you need to choice save.
 


Now you have your first project,Enjoy Coding, If any Guidelines you Want,Then Dont Be Shy to leave a Comments. I hope this a simple tutorials can help you to start coding. See you on the next tutorials Part2. Godbless you all.



No comments: