Skip to main content

Posts

Showing posts from November, 2014

How To Check Picture In Database

 Private Sub CARI_FOTO()         MyConnection.TUTUPKONEKSI()         cmd = New SqlCommand("Select Photo, AutoRecordNoStamp From mstSTAMP " & _                             "Where AutoRecordNoStamp='" & LblAutoStampNo.Text & "'", MyConnection.BUKAKONEKSI)         DTR = cmd.ExecuteReader         DTR.Read()         'Cek kalo2 data gambar ada ato gak didalam database 01.12.2014         If DTR("Photo").ToString <> "" Then             Dim Gambar As New IO.MemoryStream _             (CType(DgvSTAMP.Item(7, DgvSTAMP.CurrentRow.Index).Value, Byte()))             ImgFOTO.SizeMode = PictureBoxSizeMode.StretchImage             ImgFOTO.Image = Image.FromStream(Gambar)         Else             ImgFOTO.Image = Nothing         End If     End Sub

How To Check If Cell Value In Datagridview Is Null Or Empty

Here is this another thing that i try to solve in doing a project with VB.Net. Scheme : i want my application to load data from datagridview to textbox or combobox but the trouble is datagridview cannot load data from an empty/null cell column.   Private Sub DgvSTAMP_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvSTAMP.CellContentClick        'Cek bila nilai pada cell di datagridview ada yang kosong         For F As Integer = 0 To DgvSTAMP.RowCount - 1             If IsDBNull(DgvSTAMP.CurrentRow.Cells(1).Value) Then                 TxtSTAMPNO.Text = ""             Else                 TxtSTAMPNO.Text = DgvSTAMP.Item(1, DgvSTAMP.CurrentRow.Index).Value             End If             If IsDBNull(DgvSTAMP.CurrentRow.Cells(2).Value) Then                 TxtINSPECTORNAME.Text = ""             Else                 TxtINSPECTORNAME.Text = DgvSTAMP.Item(2, DgvSTAMP.CurrentRow.Index)

How To Load Month And Year In ComboBox Using VB.Net

create 2 ComboBox 1. CmbBulan 2. CmbTahun Private Sub Isi_Combo_Pencarian()         With CmbBulan             Dim Angka As Integer             .DataSource = Nothing             .Items.Clear()             For i = 0 To 11                 Angka = i + 1                 .Items.Add(Angka)             Next         End With         With CmbTahun             Dim P As Integer = Year(Now) - 5             Dim A As Integer = Year(Now)             .DataSource = Nothing             .Items.Clear()             For i = P To A                 .Items.Add(i)             Next         End With     End Sub