Delete Things In A Listview?
Hey guys I have a listview called lvwfound, and it contains file locations like C:windowsotepad.exe
now I would like to use the kill command, but how would I kill whats in the first column in a listview? would it be something like Kill Me.lvwFound.ListItems(1), 0, 0?
so if there was many items to delete it would have to go through them all one after another, so would it end up being like this...??
VB Code: Dim Z As Integer For Z = 0 To lvwFound.ListItems - 1 Kill (Me.lvwFound.ListItems(1), 0, 0(Z)) Next Z
??? I would like to test it out, but I am afraid I might delete the wrong thing by accident lol
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Delete Things From A Text File?
OK, I've got a nice Stores.txt file with all these store numbers and names in it. I can add to it, display it, etc pretty nicely, but how do I delete stuff from it?
It looks like this
1, "StoreName1"
2, "StoreName2"
3, "StoreName3"
I can isolate the store number and name I want to delete, but I can't figure out how to delete it.
Any help?
Thanks
Shawn
Moving Things From One Listview To Another
Hey guys I have one listview called report on a form call antivirus. This listview has checkboxes.
I have another listview with no check boxes on a form call resuls.
What I would like to do is when an item or items is checked, whatever is in the first column of the report listview on the antivirus form goes in the results listview on the resuls form. The same as the second column, I would like that repeated as well.
But the twist is if the user checks a problem and then presses the delete button. I would like the 3rd column of the results listview on the resuls form to say "Deleted" for that checked item.
OR if the user checks a problem and presses ignore then it would just say Ignored by the item in the 3rd column.
Can anyone tell me how I could do all that?
Thanks!
Moving Things From A Listview To A Textbox?
Hey guys I have a listview called report and it has check boxes. I have another form called form2 with a text2.text.
Is there a way when I check one item and press a button that checked item goes in the text2 of the form2?
Its just the item from the first column of the report listivew.
Thanks!
Moving Things And Deselecting Things.
Okay, I have two questions. First I'll give you the noobish one. How do you deselect something like a command button so it's not highlighted? I also have a problem with my end of the year project I asked for help with a while ago. I'm trying to make it so that when you click a button, the notes on a measure (of music) move down to the next set of lines instead of going to the right off the screen. It's hard to explain, but here's the code for the command button:
VB Code:
Private Sub Command1_Click()intOMG = intOMG + 1If intOMG > 8 Then Command1.Enabled = FalseEnd IfLine1(Line1.lbound + intOMG).Visible = TrueLine2(Line2.lbound + intOMG).Visible = TrueLine3(Line3.lbound + intOMG).Visible = TrueLine4(Line4.lbound + intOMG).Visible = TrueLine5(Line5.lbound + intOMG).Visible = True End Sub
Here's a picture of the form, which is probably the best way I can show you:
http://img.photobucket.com/albums/v6...r/untitled.jpg
Also, how can I make that scrollbar work? This should be my last question about my project (seeing as it's due tomorrow), so thanks to those who help.
ListView Help (add/delete)
I am in need of some help trying to get my ListView to act as i had my combobox do.
Here is the code that i used to do this same thing but with a combobox:
Code:
Private Sub NameBox_Click(Index As Integer)
Dim i As Integer, ItemName As String
If NameBox(Index).Value = 1 Then
NameBox(Index).Caption = Replace(cboNames, "> ", vbCr)
NameBox(Index).Tag = cboNames.ListIndex
ItemName = cboNames
For i = 0 To cboNames.ListCount - 1
If cboNames.List(i) = ItemName Then
cboNames.RemoveItem i
Exit Sub
End If
Next i
Else
NameBox(Index).Value = 0
cboNames.AddItem Replace(NameBox(Index).Caption, vbCr, "> ")
NameBox(Index).Caption = "No one"
NameBox(Index).Tag = ""
End If
End Sub
Now this is the code im working on to put that same thing into a listview:
Code:
Private Sub NameBox_Click(Index As Integer)
Dim i As Integer, ItemName As String
If NameBox(Index).Value = 1 Then
NameBox(Index).Caption = LV1.SelectedItem
NameBox(Index).Tag = LV1.SelectedItem.Index
ItemName = LV1.SelectedItem
For i = 0 To LV1.ListItems.count - 1
If LV1.SelectedItem.SubItems(i) = ItemName Then
LV1.ListItems.Remove i
Exit Sub
End If
Next i
Else
NameBox(Index).Value = 0
LV1.ListItems.Add NameBox(Index).Caption
NameBox(Index).Caption = "No one"
NameBox(Index).Tag = ""
End If
End If
I just can not get it to act the same way. Could someone help me out with this code of mine so that it will do the same as the combobox did?
Thanks,
David
Delete Row From Listview
Ive looked all over the net for this, and cant find anything.
I need a simple way of deleting a row from a listview. The data is stored in a textfile, but for now im not worried about rewriting the datafile. I just need a way of deleting the row. theres about 6 columns in the listview.
anyone know how to do this?
cheers
Dave
Listview Delete
Hey all
how do you delete the first item in listview for vb.net
thank you
Delete From ListView?
I cant figure out how to delete from ListView control... There are so many ".Remove" 's. Here is the code i have:
VB Code:
Private Sub mnuRemoveMedia_Click() If MsgBox("Are you sure you want to remove this media?", vbYesNo + vbQuestion, "Delete?") = vbNo Then 'check if you really want to delete this record Exit Sub 'exit the command Else Set rs = New ADODB.Recordset Set conn = New ADODB.Connection conn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & App.Path & "mediaplayer.mdb;Uid=;Pwd=;" conn.CursorLocation = adUseClient conn.Open rs.Open "DELETE FROM `songs` WHERE location='" & lstLib.selectedItem.SubItems(4) & "'", conn, adOpenDynamic 'rs.Close 'Set rs = Nothing 'conn.Close 'Set conn = Nothing Dim q As String q = lstLib.selectedItem.Index lstLib.ListItems.Item(q).ListSubItems.Remove End IfEnd Sub
Delete From DB Using ListView
The ListView entry is deleted from the ListView but it wont delete from the DB. Am I missing something simple? Please advise, thanks in advance.
VB Code:
Public Sub DeleteEntryFromDatabase() DatabaseConnection LedgerSelectAllSQL OpenRecordset If MsgBox("Are you sure you want to delete this entry?", _ vbQuestion + vbYesNo, "Confirm Delete.") = vbYes Then With frmLedger.lvwAccountLedger strSQL = "DELETE " strSQL = strSQL & "FROM Ledger " strSQL = strSQL & "WHERE AccountNumber = '" & frmLedger.cboAccountNumber.Text & "' " strSQL = strSQL & "AND EntryDate = '" & .SelectedItem.Text & "' " strSQL = strSQL & "AND TransDesc = '" & .SelectedItem.SubItems(1) & "' " strSQL = strSQL & "AND Credit = '" & .SelectedItem.SubItems(2) & "' " strSQL = strSQL & "AND Debit = '" & .SelectedItem.SubItems(3) & "'" objCon.Execute strSQL .ListItems.Remove (.SelectedItem.Index) End With End If AddListViewColumnEntries DisplayEndingBalance CloseRecordset CloseConnectionEnd Sub
Delete From ListView
I'm wondering how to delete an item in the ListView Populated from a Table in. I've tried to delete only the selected item from the ListView, it's deleted, but once you close the form and cameback again you will notice the item delete is the FirstItem in the Table.
I've used the below code but it won't be helpfull to fulfill my needs.
Could someone help please?
VB Code:
RSLevels.Open "Select Levels.ID FROM Levels WHERE levels.ID= " & (ListView1.SelectedItem.Key), Conn, adOpenDynamic, adLockOptimistic, adCmdTable With RSLevels .Delete adAffectCurrent .Update .Requery Me.ListView1.Refresh .Close End With If ListView1.SelectedItem.Index <> 1 Then ListView1.ListItems.Remove ListView1.SelectedItem.Index MsgBox " Item Deleted", vbExclamation, "Delete Item" End If End If
Thanks,
Habibalby
ListView Help (Add/Delete)
I am in need of some help trying to get my ListView to act as i had my combobox do.
Here is the code that i used to do this same thing but with a combobox:
Code:
Private Sub NameBox_Click(Index As Integer)
Dim i As Integer, ItemName As String
If NameBox(Index).Value = 1 Then
NameBox(Index).Caption = Replace(cboNames, "> ", vbCr)
NameBox(Index).Tag = cboNames.ListIndex
ItemName = cboNames
For i = 0 To cboNames.ListCount - 1
If cboNames.List(i) = ItemName Then
cboNames.RemoveItem i
Exit Sub
End If
Next i
Else
NameBox(Index).Value = 0
cboNames.AddItem Replace(NameBox(Index).Caption, vbCr, "> ")
NameBox(Index).Caption = "No one"
NameBox(Index).Tag = ""
End If
End Sub
Now this is the code im working on to put that same thing into a listview:
Code:
Private Sub NameBox_Click(Index As Integer)
Dim i As Integer, ItemName As String
If NameBox(Index).Value = 1 Then
NameBox(Index).Caption = LV1.SelectedItem
NameBox(Index).Tag = LV1.SelectedItem.Index
ItemName = LV1.SelectedItem
For i = 0 To LV1.ListItems.count - 1
If LV1.SelectedItem.SubItems(i) = ItemName Then
LV1.ListItems.Remove i
Exit Sub
End If
Next i
Else
NameBox(Index).Value = 0
LV1.ListItems.Add NameBox(Index).Caption
NameBox(Index).Caption = "No one"
NameBox(Index).Tag = ""
End If
End If
I just can not get it to act the same way. Could someone help me out with this code of mine so that it will do the same as the combobox did?
Thanks,
David
Delete From Listview Problem Need Help
i'm trying to delete items in a listview... however i want to know whether the user has selected an item to delete... how do i know if the user has selected an item from the list view or not...
Delete Item From Listview Box?
sorry, but I've another question on listview!
I know now how to get a selected item within a populated listview box, what I'd like to know now is is it possible to delete an entry in listview and then move up the items below it?
Delete ListView Item
Is this not the way to delete a selected ListView Item?
Code:
If Form4.STlv.ListItems.Count > 0 Then
a = Form4.STlv.SelectedItem
Form4.STlv.ListItems.Remove a
Call SaveList
EndIf
Delete From Listview And Textfile
Ok... ive managed to sort out adding data from a textfile into columns in a listview (Cheers Biscuitbandit).
Ive almost completed everything else on the program, bar one thing... deleting a row from the listview and its corresponding line in the text file.
The data is stored as follows:
Quote:
"Thurston","David","22 Thamley Road","Coundon","Coventry","Warwickshire","CV61DX","07734950379"
"Worley","Steven","29 The street","worlingham","beccles","suffolk","NR347uh","9948873766453"
"Donovan","Paul","14 pinewood Gardens","North Cove","Beccles","Suffolk","NR458uh","883774637276"
The data is the sorted alphabetically in the listview.
I need to be able to select the last name of the person in the listview, then hit a delete button, and it removes the contacts row, and the line from the data file. I cant really see a way of doing this.... possibly to delete the row, and rewrite the data file based on this new data?
If thats an option, how would i go about it? or has anyone got any better ideas on how to do this?
Delete Row In Listview Control
Hello,
I am in a problem. The problem is that I have got a listview control. The control is populated with some data and the listview's view property is set to report view. What I want is that when I select a row in the listview I want to delete that row. Is it possibl. If yes please give me any idea.
Thanx in advance.
Arghya
Multi-delete From Listview
I have a listview holding a list of items. I want to be able to select more than 1 item at once and delete the selected items. I have set multiselect to true on the listview. What code is needed to ensure the "multi-delete" from the listview?
Trying To Delete Items From ListView And DB
Hello. I am trying to delete items from a ListView and the correspnding selection out of the database. So far I can delete from the listview but not the DB.
Any ideas?
Code:
GetConn
Set rs = New ADODB.Recordset
Dim sql As String
For i = lvwResults.ListItems.Count To 1 Step -1
If (lvwResults.ListItems(i).Selected = True) Then
lvwResults.ListItems.Remove i
sql = "SELECT Sites.Url FROM Sites WHERE Sites.Url = '" & lvwResults.SelectedItem.Index(i) & "'"
rs.Open sql, conn, adOpenStatic, adLockOptimistic
rs.Delete adAffectCurrent
End If
Next i
rs.Close
Set rs = Nothing
CloseConn
Exit Sub
How To Delete Listview Items
I have listview control in the form, it is in report view, full rowselect enabled. Listview contains few listitems and subitems. All i want to do is how could i delete the selected listview item with command button. Suppose The items are in serial, for eg.
1,2,3...and so on........Suppose I delete item 2 , how can i automatically re number the item with serial no 3 to serial no.2
thanx
saracjl
Delete ListView Entries
How can i delete previous listview entries so that when i populate it again it will start a new set of list?
Delete Item In Listview Control
Hi there, this is my scenario, (I'm using Access ND VBA)
I add and item(+ subitems) to the Listview control here is my code:
Code:
If Me.Caption = "Add New Material" Then
Set itmx = Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.ListItems.Add()
'Set itmx = Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.ListItems.Add(, , CStr(Me.cboMaterials.Column(0))) ' Variable = MaterialsRef
itmx.Text = Me.cboMaterials.Column(0)
itmx.SubItems(1) = Me.cboMaterials.Column(1) ' Variable = MaterialsDescription
itmx.SubItems(2) = Me.txtNumber ' Variable = MaterialsNumber
Else
Set itmx = Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.ListItems.Add()
itmx.Text = Me.cboMaterials.Column(0)
'Set itmx = Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.ListItems.Add(Me.cboMaterials.Column(0), , 0) ' Variable = MaterialsRef
itmx.SubItems(1) = Me.cboMaterials.Column(1) ' Variable = MaterialsDescription
itmx.SubItems(2) = Me.txtNumber
'ListViewIndex ListView1.SelectedItem
sdfsdf = Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.Items.Remove(Forms!CopyAddModifyShoppingList!LvwMaterialRequirements.SelectedItem)
End If
Set itmx = Nothing
What I'm trying to do is this:
(1) Get the item selected and modify it(using other forum), this is done
(A) I want to add the modified item in the same position as before,
(B) When a is done remove the selected item plus one.
But I cannot get this to work no matter what I do.
the pig..
ABout Listview,edit And Delete Function
hai every one, i got a problem when i want to refresh my listview using timer
1. i have put a timer under my listing form but after i save a record to a database. this listview will automatically refresh with this new record.
so can anyone help me on this.
2. how should i write when i click on the record under my listview and it will amend the record?
3. I still can't get the delete coding. do anyone have a very sample coding for a delete function?
Delete/edit Records(.mdb) From Listview
Hi all,
i searched all the forums but no exact answer for my problem.
My problem is,
I have a customer phonebook database (access mdb).
I use listview to show the records. i use sql to filter and show in listview.
I put rightclick actions on listview items for 'copy'.
but i need to edit the selected item and
also i need to delete the selected item (delete also from the database not only in the listview) by selecting from rightclick option.
i know that i have to call the records from the database to tdo this but my knowledge about vb6 is not enough to achieve this.
can you give me the short code example for this?
if needed i will send my project for inspect...
Thanks for your time....
Avoid Delete Items From The Listview
I'm working an application for a restaurant I need that if the waiter save items to the database and if that "Order" is still open, the waiter can add new item and can see those items that he save it before but he can't delete those items that he save it before
Elvis Cabral
How To Delete And Edit Records Using Listview
hi, how can i delete and edit records currently selected in my listview. I'm using msaccess database. I'm a newbei in database. TIA!
I have Command button for deleting and Edit records
here is my code for displaying of data on my listview:
vbcode Code:
Sub LoadAll()
Dim lv As ListItem
DataList.ListItems.Clear
openRS "SELECT * FROM Repairs"
While Not rs.EOF
Set lv = DataList.ListItems.Add(, , rs!JobOrder)
lv.SubItems(1) = rs!PhoneBrand
lv.SubItems(2) = rs!imei
lv.SubItems(3) = rs!Complaint
lv.SubItems(4) = rs!Remarks
lv.SubItems(5) = rs!Amount
lv.SubItems(6) = rs!With_SIM
lv.SubItems(7) = rs!With_Battery
lv.SubItems(8) = rs!Paid
lv.SubItems(9) = rs!RecievedBy
lv.SubItems(10) = rs!CustomerName
lv.SubItems(11) = rs!Customer_Address
lv.SubItems(12) = ContactNumber
lv.SubItems(13) = rs!Person_in_charge
lv.SubItems(14) = rs!DateRecieved
lv.SubItems(15) = rs!DateReleased
rs.MoveNext
Wend
End Sub
and here is my codes for adding records.
Code:
Private Sub btnAdd_Click()
openRS "SELECT * FROM Repairs"
rs.AddNew
rs!JobOrder = jobnum
rs!PhoneBrand = phbrand.Text
rs!imei = imei.Text
rs!Complaint = txtplaint.Text
rs!Remarks = txtremarks.Text
rs!Amount = amnt.Text
rs!With_SIM = simt.Text
rs!With_Battery = batt.Text
rs!Paid = paidt.Text
rs!RecievedBy = reciev.Text
rs!CustomerName = custmerName.Text
rs!Customer_Address = txtAdd.Text
rs!ContactNumber = custnum.Text
rs!Person_in_charge = techtx.Text
rs!DateRecieved = pickrecieve.Value
rs!DateReleased = pickrelease.Value
rs.Update
End Sub
Delete Listview && Access Database
VB Code:
Set db = OpenDatabase(App.Path & "MDSLibrary.mdb")Set Counter = db.OpenRecordset("Select LoanCounter From MEMBER Where MemberID=" & LMemberID) TempMCounter = (Counter!LoanCounter)Set TempLMember = db.OpenRecordset("Select MemberID From LOAN Where ISBN='" & Trim(lvloanReturn.SelectedItem.Text) & "'") TempLMemberID = (TempLMember!MemberID) db.Execute ("DELETE FROM LOAN WHERE LoanID = " & LMemberID) db.Execute ("Update MEMBER set LoanCounter ='" & TempMCounter & "' where MemberID =" & TempLMemberID) For i = lvloanReturn.ListItems.Count To 1 Step -1 if lvloanReturn.listitems(i).selected then lvloanReturn.ListItems.Remove (i) TempMCounter = TempMCounter - 1 lvloanReturn.Refresh end if Next
OBJECTIVE : Delete selected item(s) from listview & database
When i execute this code, it'll only delete those item from listview only
Can anyone help me out. Which part did i wrongly code?
Delete Groupwise Attachment From Listview
Good day,
I have written a VB6 program to send email with attachments. The attachments are selected from different directories using commondialog box and placed in a listview. Now I need to be able to remove attachments, if I do so the wrong attachment is removed, one thing I have noticed is wheneve I display the selected item index from a listview I get the wrong index. The index is counted from right to left. For example if I have 3 attachments in the listview, the last attachment's index will be 1 instead of 3.
Thanks for ur help. My code is as follows:
Private Sub mnuAdd_Click()
cmdDlg.ShowOpen 'select the file to be attached
Call lstAttachments.ListItems.Add(1, , cmdDlg.FileTitle)
Set GWAttachment = GWAttachments.Add(cmdDlg.FileName)
lstAttachments.Refresh
Set GWAttachment = Nothing
End Sub
Private Sub mnuRemove_Click()
Set GWAttachment = GWAttachments.Item(lstAttachments.SelectedItem.Index)
Call lstAttachments.ListItems.Remove(lstAttachments.SelectedItem.Index)
GWAttachment.Delete
End Sub
Listview Double-click Delete Row
Hi guys,
I have a listview with three columns.
A user may double-click a row to remove that row from the listview (and all rows below move up to take the deleted row's place).
Problem is, if the user double clicks in the empty space *below* the list items, the list item last selected is deleted!
How do I stop this behaviour?
I assume I'd have to test for validity of the double-click event but how do I test for a user double clicking the vacant area?
Thanks,
Mark
Delete ListView Item In Binary File
I need to Delete the Selected Item in a ListView and as well as in a stored Binary. Can somebody help me with an example. Here is a brief summary.
I select the Items in a ListView. These can be multiselect. Then one by one I read the first Index value of this Item which is also the same Index value I stored in Binary File. So this way I identify the specific Record in the Binary File.
Now here comes the difficult task that how I delete this Record in Binary File. I know that I can read this particular record by GET statement but then how will I delete it. And also If I able to delete it then how I change the Record number of all other preceding Records, since the Record number need to change for all other Record after the deleted Record.
This is a very common use in many application where user select multiItems and delete it in the ListView and as well as in the storage File. I just do not underdtand. I really tried many ways and searched VB Help in Application, but no success. Can somebody help. Thanks.
Error Delete Load Data From The Listview
Hi guys:
I have a listview with 3 colummns "Qty", "Description", "Price" when i save the item to my data base is ok, but when I load the to the listview and when I want to delete items I get this error: "Run-Time error 9 Subscript out range"
This is the code i used to delete item from the listview
Code:
Private Sub cmdDelete_Click()
Dim curUnitPrice As Currency
Dim lngIndex As Long
Dim itmX As MSComctlLib.ListItem
Dim lngQty As Long
Dim strArrayA() As String
Dim strArrayB() As String
With ListView1
If Not (.SelectedItem Is Nothing) Then
strArrayA = Split(.SelectedItem.Key, "&", , vbTextCompare)
lngIndex = Mid(strArrayA(0), 2) "Here I Get The Error"
lngQty = Val(.SelectedItem.Text)
If S_Status = True Then
If CheckModify(lngQty, .SelectedItem.SubItems(1)) = False Then
MsgBox "You Can't delete this Item", vbCritical
Exit Sub
End If
End If
If lngQty > 1 Then
lngQty = lngQty - 1
strArrayB = Split(lblmenu(lngIndex).Tag, "@", , vbTextCompare)
curUnitPrice = Val(strArrayB(1))
.SelectedItem.Text = lngQty
.SelectedItem.SubItems(fncIndexCol("Precio")) = Format(lngQty * curUnitPrice, "Currency")
Else
lblmenu(lngIndex).ForeColor = vbBlack
.ListItems.Remove .SelectedItem.Index
End If
End If
I'll Appreciate you help
Elvis Cabral
Error Delete Load Data From The Listview
Hi guys:
I have a listview with 3 colummns "Qty", "Description", "Price" when i save the item to my data base is ok, but when I load the to the listview and when I want to delete items I get this error: "Run-Time error 9 Subscript out range"
This is the code i used to delete item from the listview
Code:
Private Sub cmdDelete_Click()
Dim curUnitPrice As Currency
Dim lngIndex As Long
Dim itmX As MSComctlLib.ListItem
Dim lngQty As Long
Dim strArrayA() As String
Dim strArrayB() As String
With ListView1
If Not (.SelectedItem Is Nothing) Then
strArrayA = Split(.SelectedItem.Key, "&", , vbTextCompare)
lngIndex = Mid(strArrayA(0), 2) "Here I Get The Error"
lngQty = Val(.SelectedItem.Text)
If S_Status = True Then
If CheckModify(lngQty, .SelectedItem.SubItems(1)) = False Then
MsgBox "You Can't delete this Item", vbCritical
Exit Sub
End If
End If
If lngQty > 1 Then
lngQty = lngQty - 1
strArrayB = Split(lblmenu(lngIndex).Tag, "@", , vbTextCompare)
curUnitPrice = Val(strArrayB(1))
.SelectedItem.Text = lngQty
.SelectedItem.SubItems(fncIndexCol("Precio")) = Format(lngQty * curUnitPrice, "Currency")
Else
lblmenu(lngIndex).ForeColor = vbBlack
.ListItems.Remove .SelectedItem.Index
End If
End If
I'll Appreciate you help
Elvis Cabral
Delete Listview Checked Listitem And Recordset
hi,how to delete listview checked listitem recordset.
for example:
when click the listview checked listitem to delete the recordset data.
this is the current code:
Code:
Private Sub cmdDelete_Click()
Dim rs As ADODB.Recordset
Dim conDataConnection As Connection
Dim lvwItem As ListItem
Dim strSQL As String
Set lvwItem = ListView1.SelectedItem
If Not (lvwItem Is Nothing) Then
Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"Overtime.mdb;Persist Security Info=False"
Set rs = New ADODB.Recordset
strSQL = "select * from Overtime & lvwItem.SubItems(i).Checked = True "
rs.Open strSQL error message highlight here.
ListView1.ListItems.Remove lvwItem.Index
Set lvwItem = Nothing
adoConn.Close
Set adoConn = Nothing
End If
End Sub
thanks for help.
Delete Messages From The Listview AND The Server Inbox
How would I go about doing this with the Winsock control? I have a list of POP3 commands enumerated already to help.
VB Code:
Private Enum POP3States POP3_Connect POP3_USER POP3_PASS POP3_STAT POP3_RETR POP3_DELE POP3_QUITEnd Enum
Delete Listview Checked Listitem And Recordset
hi,how to delete listview checked listitem recordset.
for example:
when click the listview checked listitem to delete the recordset data.
this is the current code:
Code: Private Sub cmdDelete_Click()
Dim rs As ADODB.Recordset
Dim conDataConnection As Connection
Dim lvwItem As ListItem
Dim strSQL As String
Set lvwItem = ListView1.SelectedItem
If Not (lvwItem Is Nothing) Then
Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"Overtime.mdb;Persist Security Info=False"
Set rs = New ADODB.Recordset
strSQL = "select * from Overtime & lvwItem.SubItems(i).Checked = True "
rs.Open strSQL error message highlight here.
ListView1.ListItems.Remove lvwItem.Index
Set lvwItem = Nothing
adoConn.Close
Set adoConn = Nothing
End If
End Sub
thanks for help!
[PROBLEM]Delete One Record From Listview And Database
I have some problems when I want to delete only one record from the listview control as well as delete from the database at the same time by clicking the "Delete" button.
I am confused by the codes because I'm still a beginner of VB 6.0. Anyone please help me to check on the codes as I did not know where went wrong.
Below are the codes:
Private Sub btnDelete_Click()
lstDate.ListItems.Remove (lstDate.SelectedItem.Index)
OpenDB
'establish connection to database
Dim dcnVisa As New ADODB.Connection
dcnVisa.CursorLocation = adUseClient
dcnVisa.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source = '" & gdcnVisa & "'"
Dim strnames As String
'create recordset
strnames = "'" & lstDate.SelectedItem.Index & "'"
Delonesql = "SELECT * FROM tblEmbassyHolidays WHERE Country='" & cmbCountry & "'"
Delonesql = Delonesql And lstDate.SelectedItem.Index
Dim rstDelone As ADODB.Recordset
Set rstDelone = New ADODB.Recordset
rstDelone.Open Delonesql, dcnVisa, adOpenStatic, adLockOptimistic
If (rstDelone.EOF = False) Then
rstDelone.MoveFirst
Do Until rstDelone.EOF
rstDelone.Delete
rstDelone.Update
rstDelone.MoveNext
Loop
End If
MsgBox ("Your record has been successfully deleted!")
Refresh_Data
End Sub
Thank you in advance to whom who help me in solving the problem! =D
P.S.It shows "Run-Time error '13' : Type mismatch" when I debug the program.
DELETE PROBLEM - Cannot DELETE After ADDing New Record Or UPDATING ?
Have a small problem here...very minor but a pain nonetheless.
Is anyone aware of any issues that would cause this problem:
If I open my form, browse through my records, and select a record to delete, and press Delete, it deletes no problem.
I can add a record, and it Inserts Into a table. If I press delete directly after, it will not delete. No error, no delete either.
or
I can update a record successfully. If I press delete directly after this, it will not delete either. Again no error, no delete either.
If I unload the form, and then reload the form again (Exit the form and re-open), I can delete the record fine.
Does anyone know what would be causing this issue?
PS - Its nothing to do with Locking/Enabling buttons etc. I checked that already. The delete button is fully enabled and unlocked ready for use.
DELETE PROBLEM - Cannot DELETE After ADDing New Record Or UPDATING ?
Have a small problem here...very minor but a pain nonetheless.
Is anyone aware of any issues that would cause this problem:
If I open my form, browse through my records, and select a record to delete, and press Delete, it deletes no problem.
I can add a record, and it Inserts Into a table. If I press delete directly after, it will not delete. No error, no delete either.
or
I can update a record successfully. If I press delete directly after this, it will not delete either. Again no error, no delete either.
If I unload the form, and then reload the form again (Exit the form and re-open), I can delete the record fine.
Does anyone know what would be causing this issue?
PS - Its nothing to do with Locking/Enabling buttons etc. I checked that already. The delete button is fully enabled and unlocked ready for use.
Edited by - VBKid04 on 4/11/2004 9:56:26 PM
Delete ListBox Item When Hit Delete From Keyboard
i want to delete an item that is selected in a listBOx when the delete button of the keyboard is hit. In order to do that i need to be able to first select an item in a listBox, however my click function doesn't seem to respond because there is a conflict with the right-click action. This is the response i had got from codeguru previously:
http://www.codeguru.com/forum/showth...7&goto=newpost
so how shud i solve that and also how can i select multiple entries in the listBox through the shift down arrow
DELETE PROBLEM - Can Delete 1 Record From 2 Tables, But No More After That :(
Hi there,
Think I may have some sort of update problem here.
I have a Delete button which when pressed, will delete the current record in CUSTOMER table, and also any corresponding records in TASK table.
When I press delete once, it deletes the current record in both recordsets.
But when I press delete again to delete the next record it says
"Cannot delete record (in Customer) as a related record is required in TASK".
Does this mean that one of the recordsets are not being updated and if so how do I fix this?
Here is my code so far:
Code:
Private Sub cmdDelete_Click()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseServer 'originally was adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:TestSystem.mdb;"
Dim X As Integer 'Check to make sure update was correctly selected, or if mistake
X = MsgBox("Delete current record?", vbYesNo, "Confirm changes")
If (X = 6) Then
Dim taskRs As Recordset
Set taskRs = New Recordset
Dim sqltask As String
sqltask = ("DELETE FROM TASK WHERE TaskID='" & txtTaskID & "'")
taskRs.Open sqltask, db, adOpenStatic, adLockOptimistic
With taskRs
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End With
Else
customerRS.CancelUpdate
End If
End Sub
Thanks for any help
Edited by - VBKid04 on 3/11/2004 6:30:28 AM
2 Things
Didn't want to make two posts, but I have 2 questions:
How do I make my program check for a certain file, create it if it isn't there, if it is then add the specified text to the bottom?
Second question:
How do I make tabbed panels?
Thanks in advance
|