Welcome To ViniCeca's World

Delete this widget from your Dashboard and add your own words. This is just an example!

FORM POPUP SURAT PESANAN

Jumat, 13 Mei 2011




Coding popup Surat Pesanan

Imports System.Data.OleDb
Imports System.Data
Public Class PopSP
Public retNoSP, retTglSP, retKdSup As String
Dim cnn As OleDbConnection
Dim cmmd As OleDbCommand
Dim dReader As OleDbDataReader
Private Sub PopSP_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call list_data()
End Sub

Private Sub list_data()
Call clear_list()

Dim sqlx As String
Dim x As Integer
sqlx = "select NOSP, TGLSP, KDSUP from SP where NOSP like '%" & Trim(txtKey.Text) & "%' order by NOSP asc"

cnn = New OleDbConnection(strConn)
If cnn.State <> ConnectionState.Closed Then cnn.Close()
cnn.Open()
cmmd = New OleDbCommand(sqlx, cnn)
dReader = cmmd.ExecuteReader

Try
While dReader.Read = True
x = Val(counter.Text)
counter.Text = Str(Val(counter.Text) + 1)
With ListView1
.Items.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(x).SubItems(0).Text = dReader.GetString(0)
.Items(x).SubItems(1).Text =
Format(CDate(dReader.GetDateTime(1)), "dd-MMMM-yyyy")
.Items(x).SubItems(2).Text = dReader.GetString(2)
End With
End While
Finally
dReader.Close()
End Try
cnn.Close()
End Sub

Private Sub clear_list()
While Val(counter.Text) > 0
ListView1.Items(0).Remove()
counter.Text = Val(counter.Text) - 1
End While
End Sub

Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Call pilih()
End Sub

Private Sub pilih()
Try
retNoSP = ListView1.SelectedItems(0).SubItems(0).Text.ToString
retTglSP = ListView1.SelectedItems(0).SubItems(1).Text.ToString
retKdSup = ListView1.SelectedItems(0).SubItems(2).Text.ToString
Me.Close()
Catch ex As Exception
MsgBox("pilih salah satu data", MsgBoxStyle.Information)
End Try
End Sub

Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
Call pilih()
End Sub
End Class

Free Template Blogger collection template Hot Deals BERITA_wongANteng SEO theproperty-developer

0 komentar:

Posting Komentar