Skip to content

Instantly share code, notes, and snippets.

View wingedpanther's full-sized avatar

Vivek ×͜× wingedpanther

View GitHub Profile
@wingedpanther
wingedpanther / form1.vb
Last active November 19, 2015 11:33
Dictionary
Public Class Form1
Dim MsgBox_Buttons As New Dictionary(Of String, MessageBoxButtons)
Dim MsgBox_Icons As New Dictionary(Of String, MessageBoxIcon)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
With MsgBox_Buttons
.Add("OK", MessageBoxButtons.OK)
.Add("OKCancel", MessageBoxButtons.OKCancel)
@wingedpanther
wingedpanther / file.vb
Created November 19, 2015 11:28
To get the name of all forms in the project
Dim allForms() As Form = (From t As Type In Me.GetType().Assembly.GetTypes() _
Where t.BaseType Is GetType(Form) _
Let f = DirectCast(Activator.CreateInstance(t), Form) _
Select f).ToArray
@wingedpanther
wingedpanther / SelRowsToList.vb
Created November 19, 2015 11:31
Get a list of selected Rows in DataGrdiView
Dim selectedRows As List(Of DataGridViewRow) = (From row In dataGridView1.Rows.Cast(Of DataGridViewRow)() _
Where Convert.ToBoolean(row.Cells("checkBoxColumn").Value) = True).ToList()
@wingedpanther
wingedpanther / CountNoValuesInAColumn.vb
Created November 19, 2015 11:32
get counts of values in a column DGV
Dim count = (From row As DataGridViewRow In dgvb.Rows _
Where row.Cells("Name").Value = "Sunshine" And row.Cells("Name").Value IsNot DBNull.Value _
Select row.Cells("Name").Value).Count()
@wingedpanther
wingedpanther / GET_STRING_BETWEEN.vb
Created November 19, 2015 11:34
GET_STRING_BETWEEN
Function GET_STRING_BETWEEN(ByVal start As String, ByVal parent As String, ByVal [end] As String)
Dim output As String
output = parent.Substring(parent.IndexOf(start) _
, (parent.IndexOf([end]) _
- parent.IndexOf(start)) _
).Replace(start, "").Replace([end], "")
output = start & output & [end]
Return output
End Function
Public Function CALCULATE_AGE(ByVal dob As Date) As Integer
Dim age As Integer
age = Today.Year - dob.Year
If (dob > Today.AddYears(-age)) Then age -= 1
Return age
End Function
Public Class frm_customer_orderproduct
Dim current_id As String
'NEW CODE IS HERE
Dim dt As New DataTable
Private Sub frm_customer_orderproduct_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Dim regDate As Date = Date.Today()
'NEW CODE IS HERE
dt.Columns.Add("Product ID")
dt.Columns.Add("Product Name")
Dim obj As Object = If(System.IO.File.Exists("C:\file.txt"), System.IO.File.ReadAllText("C:\file.txt").Length <> 20, False)
If obj Then
MessageBox.Show("Code executed!")
Else
MessageBox.Show("Failed to execute!")
End If
Try
'con.Open()*/
Query = "INSERT INTO mcs.custormer (custormer_id,first_name,last_name,nic_no,c_address1,c_address2,c_address3,c_telephoneno,membership_date,business_name,g_name,g_nicno,g_address1,g_address2,g_address3,g_telephoneNO)" & _
"VALUES (@custormer_id,@first_name,@last_name,@nic_no,@c_address1,@c_address2,@c_address3,@c_telephoneNO,@membership_date,@business_name,@g_name,@g_nicno,@g_address1,@g_address2,@g_address3,@g_telephoneNO)"
Using cmd = New MySqlCommand(Query, con)
cmd.Parameters.AddWithValue("@custormer_id", Convert.ToInt32(txtcustormerid.Text))
cmd.Parameters.AddWithValue("@first_name", Convert.ToString(txtfirstname.Text))
cmd.Parameters.AddWithValue("@last_name", Convert.ToString(txtlastname.Text))
cmd.Parameters.AddWithValue("@nic_no", Convert.ToString(txtnicno.Text))
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="aosp"
fetch="https://android.googlesource.com/"
review="https://android-review.googlesource.com/" />
<remote name="github"
fetch="https://github.com/" />
<remote name="SimpleAosp"
fetch="https://github.com/SAOSP-N/" />