VB Environment

[code language=”vb”] Private Sub frm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load</pre> Debug.Print(Environment.MachineName.ToUpper) Debug.Print(Environment.OSVersion.ToString) Debug.Print(Environment.UserDomainName) Debug.Print(Environment.UserName) Debug.Print(Environment.CurrentDirectory) Debug.Print(Environment.Is64BitOperatingSystem) End Sub &nbsp; [/code]

VB SqlClient Read data from database

[code language=”vb”] Imports System.Data.SqlClient Public Class frmDatabaseConn Public strSQLConn As String Private Sub frmDatabaseConn_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load strSQLConn = "Data Source=ServerName;Initial Catalog=AdventureWorks2014;Persist Security Info=True;User ID=sa;Password=YourSecret" ReadDataFromDB() End Sub Private Sub ReadDataFromDB() Dim sqlConn As New SqlConnection(strSQLConn) Dim cmd Read More

VB SqlClient Insert Data to database

  [code language=”vb”] Imports System.Data.SqlClient Public Class frmDatabaseConn Public strSQLConn As String Private Sub frmDatabaseConn_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load strSQLConn = "Data Source=ServerName;Initial Catalog=AdventureWorks2014;Persist Security Info=True;User ID=sa;Password=Your@Secret" End Sub Private Sub btnInsertPara_Click(sender As System.Object, e As System.EventArgs) Handles btnInsertPara.Click Read More

VB Simple Collision Detection

Private Sub CollisionDetect() LblGroupA_RE.Text = “—” LblGroupA_LE.Text = “—” LblGroupA_TC.Text = “—” LblGroupA_BC.Text = “—” If PicMe.Left < PicEnemy.Left AndAlso PicMe.Right > PicEnemy.Left Then If PicMe.Top < PicEnemy.Top AndAlso PicMe.Bottom > PicEnemy.Bottom Then LblGroupA_RE.Text = “Right is Attacked” Timer1.Enabled = False End Read More