1. Browse to show image on form
Private Sub Buttonaddimage_Click(sender As Object, e As EventArgs) Handles Buttonaddimage.Click
Dim ofd As New OpenFileDialog
If ofd.ShowDialog = DialogResult.OK Then
If ofd.FileName <> String.Empty Then
imgpath = ofd.FileName
Dim bm_source As New Bitmap(Bitmap.FromFile(ofd.FileName), 200, 200)
PictureBox1.Image = bm_source
End If
End If
End Sub
2. Add Item include image
Private Sub additem_Click(sender As Object, e As EventArgs) Handles additem.Click
Dim comm2 As New OdbcCommand
Dim comm3 As New OdbcCommand
Dim status As Byte
Dim userid2 As Byte
Form1.connect()
Form1.conn.Open()
comm2 = Form1.comm
Dim itemgroupid As Integer
comm2 = New OdbcCommand("INSERT INTO `tbl_item`(`igroup_id`, `item_code`, `item_name`, `qty`, `price_out`, `expire_date`, `image`, `status_id`, `created_date`, `created_by`) VALUES (?,?,?,?,?,?,?,?,?,?)", Form1.conn)
Dim comm As New OdbcCommand
Dim odt As New DataTable
Dim ods As New DataSet
comm3 = New OdbcCommand("select igroup_id from tbl_item_group where igroup_name='" & ComboBoxitemgroup.Text & "'", Form1.conn)
Dim myDA As OdbcDataAdapter = New OdbcDataAdapter(comm3)
myDA.Fill(ods, "tbl_item_group")
odt = ods.Tables("tbl_item_group")
itemgroupid = odt.Rows(0).Item(0)
comm2.Parameters.AddWithValue("igroup_id", itemgroupid)
comm2.Parameters.AddWithValue("item_code", Me.TextBoxitemcode.Text)
comm2.Parameters.AddWithValue("item_name", Me.TextBox1.Text)
comm2.Parameters.AddWithValue("qty", Me.TextBoxquantity.Text)
comm2.Parameters.AddWithValue("price_out", Me.TextBoxsellout.Text)
comm2.Parameters.AddWithValue("expire_date", CDate(Me.DateTimePicker1.Text))
Dim bm_source As New Bitmap(Bitmap.FromFile(imgpath), 400, 400)
Dim clone As Bitmap = CopyBitmap(bm_source)
Dim timeStamp As String = DateTime.Now.ToString("yyyyMMddhhmmss")
clone.Save("C:\Users\Laptop\Desktop\rathana\" & timeStamp & ".bmp", ImageFormat.Bmp)
comm2.Parameters.AddWithValue("image", "C:\Users\Laptop\Desktop\rathana\" & timeStamp & ".bmp")
If Comitemstatus.Text = "Active" And Comitemstatus.Text <> "" Then
status = 1
Else
status = 0
End If
comm2.Parameters.AddWithValue("status_id", status)
comm2.Parameters.AddWithValue("created_date", Now)
userid2 = Form1.userid
comm2.Parameters.AddWithValue("created_by", userid2)
comm2.ExecuteNonQuery()
Form1.conn.Close()
End Sub
Saturday, August 23, 2014
Sunday, August 3, 2014
Wednesday, July 23, 2014
http://www.pcworld.com/article/247392/my_computer_reboots_when_i_tell_it_to_shut_down.html
http://www.pcworld.com/article/247392/my_computer_reboots_when_i_tell_it_to_shut_down.html
Wednesday, July 2, 2014
jQuery not working after the content is loaded through AJAX
$(document) refers to the whole document.
$(document).on('click', "#click", function () {
$('#click').css({
"background-color": "#fff",
"color": "#000",
"cursor": "inherit"
}).text("Open this window again and this message will still be here.");
return false;
});
jquery with page loaded by ajax
$(document).on('click', "#checkall", function () {
$(".tours_table tr").not(".tours_table tr:eq(0)").click(function(){
$(this).toggleClass("selecting");
});
$("#checkall").change(function () {
$(".tours_table table input:checkbox").prop('checked', $(this).prop("checked"));
});
$(".tours_table table input:checkbox").not("#checkall").change(function(){
if($("#checkall:checkbox").attr("checked","checked")){
$("#checkall:checkbox").removeAttr("checked");}
});
});
ajax with codeigniter
function delete1(){
var num_record1 = new Array();
$('.checkname1:checked').each(function () {
var e = $(this);
num_record1.push(e.val());
});
var showarray=new Array();
$.ajax({
type:'post',
url:'deletetours',
data:{showarray:num_record1},
success: function(data) {
$("#showtype").html(data);
}
,
error: function() {
alert('error');
}
});
//});
}
var num_record1 = new Array();
$('.checkname1:checked').each(function () {
var e = $(this);
num_record1.push(e.val());
});
var showarray=new Array();
$.ajax({
type:'post',
url:'deletetours',
data:{showarray:num_record1},
success: function(data) {
$("#showtype").html(data);
}
,
error: function() {
alert('error');
}
});
//});
}
Tuesday, June 10, 2014
Subscribe to:
Posts (Atom)