UIC BSCS ‘07
Code and Snippets for vb.net 2005-
How to add groups on listview
Posted on May 28th, 2009 No commentsI have here a simple sample on how to group in a listview. I hope this simple code can help to someone needed this.

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim group1 As New ListViewGroup(”Group 123″, HorizontalAlignment.Left)
group1.Name = “Group 123″
ListView1.Groups.Add(group1)With ListView1.Items
.Add(”123″)
.Item(.Count - 1).SubItems.Add(”ABC”)
.Item(.Count - 1).SubItems.Add(”1/11/05″)
.Item(.Count - 1).SubItems.Add(”1″)
.Item(.Count - 1).SubItems.Add(”TV”)
.Item(.Count - 1).Group = group1
.Add(”123″) .Item(.Count - 1).SubItems.Add(”DEF”)
.Item(.Count - 1).SubItems.Add(”1/11/05″)
.Item(.Count - 1).SubItems.Add(”1″)
.Item(.Count - 1).SubItems.Add(”VCD”)
.Item(.Count - 1).Group = group1
.Add(”123″)
.Item(.Count - 1).SubItems.Add(”GHI”)
.Item(.Count - 1).SubItems.Add(”1/11/05″)
.Item(.Count - 1).SubItems.Add(”1″)
.Item(.Count - 1).SubItems.Add(”TVRACK”)
.Item(.Count - 1).Group = group1Dim group2 As New ListViewGroup(”Group 234″, HorizontalAlignment.Left)
group2.Name = “Group 234″ListView1.Groups.Add(group2)
.Add(”234″)
.Item(.Count - 1).SubItems.Add(”KLM”)
.Item(.Count - 1).SubItems.Add(”1/12/06″)
.Item(.Count - 1).SubItems.Add(”1″)
.Item(.Count - 1).SubItems.Add(”MIC”)
.Item(.Count - 1).Group = group2
End With
End SubEnd Class
-
How to make borderless form draggable?
Posted on May 7th, 2009 5 commentsMaking a form without a border is nice to see especially when the user don’t want his form to minimize and maximize. I have here the following code that will make a borderless form draggable.
‘Declare these 2 variables with class scope
Private Const WM_NCLBUTTONDOWN As Integer = &HA1S
Private Const HTCAPTION As Integer = 2‘Then handle your form.MouseDown event
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Me.Capture = False
Dim msg As Message = Message.Create(Me.Handle, WM_NCLBUTTONDOWN, New IntPtr(HTCAPTION), IntPtr.Zero)
Me.DefWndProc(msg)
End Sub -
How to send email using SMTP
Posted on May 7th, 2009 1 commentSending email using vb.net 2.0 framework is quite different from 1.1. The 1.1 framework is using a System.Web.Mail while 2.0 uses System.Net.Mail and it makes really different. There are some codes that are obsolete in 2.0 framework already that exist in 1.1 framework. In my case, since I am using vb.net 2.0 framework then I will share my code here that i used in my program that will send emails. I hope this will help to the people who are seeking codes that will send an email using vb.net 2.0 framework. As a default I am using gmail for my demo but it can be used to any email server as long as you know the configuration.
Set iMsg = CreateObject(”CDO.Message”)
Set iConf = CreateObject(”CDO.Configuration”)
Set Flds = iConf.Fieldsschema = “http://schemas.microsoft.com/cdo/configuration/”
Flds.Item(schema & “sendusing”) = 2
Flds.Item(schema & “smtpserver”) = “smtp.gmail.com”
Flds.Item(schema & “smtpserverport”) = 465
Flds.Item(schema & “smtpauthenticate”) = 1
Flds.Item(schema & “sendusername”) = “myemail@gmail.com”
Flds.Item(schema & “sendpassword”) = “mypassword”
Flds.Item(schema & “smtpusessl”) = 1
Flds.UpdateWith iMsg
.To = “admin@uiccs07.net”
.From = “admin@uiccs07.net>”
.Sender = “uiccs07.net”
.ReplyTo = “admin@uiccs07.net”
.Subject = “This is a subject”
.HTMLBody = “This is sample html email.”
.Organization = “uiccs07.net”
Set .Configuration = iConf
SendEmailGmail = .Send
End Withset iMsg = nothing
set iConf = nothing
set Flds = nothing -
Welcome
Posted on May 2nd, 2009 No comments
Welcome everyone. I hope you enjoy upon visiting this site. Please leave a comment or email the administrator if there is any question regarding to this site. Have a nice day and God Bless!













