Skip to main content

Posts

How To Handling Quote (') In VB.Net

hi there here i will share the way to handle quote (') during coding with VB.Net sometimes we will have data such as (MAT'L) that quote is definitely forbidden when we are use the data. create a function as below : Public Function Ganti(ByVal Kata As String) As String         Ganti = Replace(Kata, "'", "''")     End Function and here is this how you gonna use that function, read carefully Public Sub InsertDataDefect(ByVal Row As Integer)         Dim DefectName As String = dgvInputBMISDetail.Rows(Row).Cells("dgvInputBMISDetailDefectName").Value.ToString         Koneksi()         cmd = New SqlCommand("SELECT * FROM dbo.mstDEFECT WHERE (ActiveTo IS NULL) AND DefectName='" & Ganti(DefectName) & "'", Conn)         rd = cmd.ExecuteReader         rd.Read(...

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.CurrentR...

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               ...

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     ...

How To Delete File In A Folder Using VB.Net

Imports System.IO  Private Sub DeleteFileInFolder()         Dim PathFile As String = Application.StartupPath & "\PengaturanTechnical\" & LblNomorLTSeksi.Text & ".pdf"         If System.IO.File.Exists(PathFile) = True Then             System.IO.File.Delete(PathFile)             MsgBox("File Has Been Deleted Completely")         Else             MsgBox("File Does Not Exist")         End If     End Sub

How To Check If Datagridview Is Empty In VB.Net

How To Use Enter (Keyascii 13) In ComboBox