Thursday, September 25, 2014
Saturday, September 20, 2014
Friday, September 19, 2014
vb.net ( replace data in datagridview )
If DataGridView1.Rows(_xdtRow).Cells(0).Value.ToString.Contains("Team") = True Then
DataGridView1.Rows(_xdtRow).Cells(0).Value="Team that have replaced!"
vb.net (add data to datagridview with condition)
Dim _xdtRow As Integer = 0
For _xdtRow = 0 To odt2.Rows.Count - 1
If Dgvuserlist.Rows.Count < 0 Then
Dgvuserlist.Rows.Clear()
Else
If odt2.Rows(_xdtRow).Item(5).ToString = "0" Then
Dgvuserlist.Rows.Add("Male")
Else
Dgvuserlist.Rows.Add("Female")
End If
End If
Next
For _xdtRow = 0 To odt2.Rows.Count - 1
If Dgvuserlist.Rows.Count < 0 Then
Dgvuserlist.Rows.Clear()
Else
If odt2.Rows(_xdtRow).Item(5).ToString = "0" Then
Dgvuserlist.Rows.Add("Male")
Else
Dgvuserlist.Rows.Add("Female")
End If
End If
Next
vb.net (Add data to datatable)
Dim workRow As DataRow = odt2.NewRow()
workRow("Company ID") = 2
odt2.Rows.Add(workRow)
workRow("Company ID") = 2
odt2.Rows.Add(workRow)
Monday, September 15, 2014
vb.net (insert into table with store procedure)
Public Class Form1
Public conn As OdbcConnection
Public comm As OdbcCommand
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
conn = New OdbcConnection("dsn=test;uid=root")
conn.Open()
'Add the call to the stored procedure including the connection
Dim cmd As New Odbc.OdbcCommand("{ CALL sp_insertuser2(?,?) }", conn)
cmd.CommandType = CommandType.StoredProcedure
'add the parameter to the stored procedure
Me.TextBox1.Text = CInt(10)
Me.TextBox2.Text = 2
Dim IDP As OdbcParameter = cmd.Parameters.Add("@ID", OdbcType.Int)
Dim NameP As OdbcParameter = cmd.Parameters.Add("@Name", OdbcType.Text)
IDP.Value = 3
NameP.Value = "ratana 3"
cmd.ExecuteNonQuery()
Conn.Close()
Conn.Dispose()
End Sub
End Class
Public conn As OdbcConnection
Public comm As OdbcCommand
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
conn = New OdbcConnection("dsn=test;uid=root")
conn.Open()
'Add the call to the stored procedure including the connection
Dim cmd As New Odbc.OdbcCommand("{ CALL sp_insertuser2(?,?) }", conn)
cmd.CommandType = CommandType.StoredProcedure
'add the parameter to the stored procedure
Me.TextBox1.Text = CInt(10)
Me.TextBox2.Text = 2
Dim IDP As OdbcParameter = cmd.Parameters.Add("@ID", OdbcType.Int)
Dim NameP As OdbcParameter = cmd.Parameters.Add("@Name", OdbcType.Text)
IDP.Value = 3
NameP.Value = "ratana 3"
cmd.ExecuteNonQuery()
Conn.Close()
Conn.Dispose()
End Sub
End Class
Friday, September 12, 2014
vb.net (find self path)
Dim aPath As String
Dim aName As String
aName = System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0).FullyQualifiedName
aPath = System.IO.Path.GetDirectoryName(aName)
Dim bm_source As New Bitmap(Bitmap.FromFile(aPath & "\advancedsettings.png"), 40, 40)
Dim aName As String
aName = System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0).FullyQualifiedName
aPath = System.IO.Path.GetDirectoryName(aName)
Dim bm_source As New Bitmap(Bitmap.FromFile(aPath & "\advancedsettings.png"), 40, 40)
Subscribe to:
Comments (Atom)