hi...
when i save a data from text box it didnt show at the listview
how to do that?
and someone please check my delete coding

Private Sub cmdSave1_Click()
If MsgBox("Are you sure you want to save?", vbYesNo + vbQuestion) = vbYes Then
Set rec = New ADODB.Recordset
rec.Open "Select * From masterclass", Con, adOpenStatic, adLockOptimistic
If check1 Then
rec.AddNew
rec.Fields!Class = Class
If check22 Then
rec.Update
MsgBox "Your record has been save!", vbOKOnly

Class = ""
Call PopulateList(ListView1, rst)
End If
End If
End If

End Sub

Private Sub PopulateList(pList As ListView, _
pRst As ADODB.Recordset)
On Error Resume Next
Dim i As Long
Dim iColCount As Long
Dim sColName As String
Dim sColValue As String
Dim oCH As ColumnHeader
Dim oLI As ListItem
Dim oSI As ListSubItem
Dim oFld As ADODB.Field


With pList
.View = lvwReport
.GridLines = True
.FullRowSelect = True
.ListItems.Clear
.Sorted = False
pRst.MoveFirst
' set up column headers


For Each oFld In pRst.Fields
sColName = cn(oFld.Name)
Set oCH = .ColumnHeaders.Add()
oCH.Text = sColName
iColCount = iColCount + 1
Next oFld


Do Until pRst.EOF
i = 0
' setup fiprst column as a listitem
sColValue = cn(pRst.Fields(i).Value)
Set oLI = .ListItems.Add()
oLI.Text = sColValue
' add the remaining columns
'as subitems


For i = 1 To iColCount
Set oSI = oLI.ListSubItems.Add()
oSI.Text = cn(pRst(i))
Next ' next column
pRst.MoveNext
Loop ' Next record
' refresh it all
.Refresh
' make sure 1st row can be seen
.ListItems(1).EnsureVisible
Text1 = ListView1.ListItems.Count
End With

End Sub

Private Sub cmdDlt_Click()
Set tugas = New ADODB.Command
tugas.ActiveConnection = Con
tugas.CommandType = adCmdText
tugas.CommandText = "delete from masterclass where class='" & Class.Text & "'"
tugas.Execute

End Sub

you are facing problem with save or delete operation ?

both...when i save or delete the data it not show at the listview...
please help me
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.