The code I have commented out was my attempt to insert items using a loop.
Thanks,
Nightwalker
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Here is a simple way to add items to listview. This example adds one single item. You may amend this for a loop
Code:
Option Explicit
Dim colX As ColumnHeader, itmX As ListItem
Private Sub Form_Load()
ListView1.View = lvwReport
Set colX = ListView1.ColumnHeaders.Add(, , "Header1")
Set colX = ListView1.ColumnHeaders.Add(, , "Header2")
Set colX = ListView1.ColumnHeaders.Add(, , "Header3")
Set colX = ListView1.ColumnHeaders.Add(, , "Header4")
End Sub
Private Sub Command1_Click()
Set itmX = ListView1.ListItems.Add(, , Text1.Text)
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , Text2.Text
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , Text3.Text
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , Text4.Text
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Last edited by Nightwalker83; Aug 29th, 2010 at 06:00 AM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, ByVal HeadersOnly As Boolean)
'Retrieve mail from inbox
Dim i As Long
Dim lvwItem As ListItem
For i = 1 To Pop3.Messages.Count
Set lvwItem = ListView1.ListItems.Add(, , Pop3.Messages(i).From)
lvwItem.SubItems(1) = Pop3.Messages(i).Subject
lvwItem.SubItems(2) = Pop3.Messages(i).Date
Next i
End Sub
....
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, _
ByVal HeadersOnly As Boolean)
'~~> Retrieve mail from inbox
Dim i As Integer, itmM As ListItem, lstCount As Long
For i = 1 To Pop3.Messages.Count
lstCount = frmMain.LstNewMail.ListItems.Count
Set itmM = frmMain.LstNewMail.ListItems.Add(, , Pop3.Messages(i).From)
frmMain.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Subject
frmMain.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Date
Next i
End Sub
Last edited by Siddharth Rout; Aug 30th, 2010 at 01:25 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, ByVal HeadersOnly As Boolean)
'Retrieve mail from inbox
Dim i As Long
Dim lvwItem As ListItem
For i = 1 To Pop3.Messages.Count
Set lvwItem = ListView1.ListItems.Add(, , Pop3.Messages(i).From)
lvwItem.SubItems(1) = Pop3.Messages(i).Subject
lvwItem.SubItems(2) = Pop3.Messages(i).Date
Next i
End Sub
....
Originally Posted by koolsid
Is This what you are trying...
Code:
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, _
ByVal HeadersOnly As Boolean)
'~~> Retrieve mail from inbox
Dim i As Integer, itmM As ListItem, lstCount As Long
For i = 1 To Pop3.Messages.Count
lstCount = frmMain.LstNewMail.ListItems.Count
Set itmM = frmMain.LstNewMail.ListItems.Add(, , Pop3.Messages(i).From)
frmMain.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Subject
frmMain.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Date
Next i
End Sub
I receive an "Invalid procedure call or argument" on the "Set" line.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Last edited by Nightwalker83; Aug 30th, 2010 at 05:53 AM.
Reason: Fixed spelling
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Did your present code works ?
I mean, does it show the same error message ?
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
No, the code in my previous post (post #9) works! However, you will notice I keep repeating the code when it comes to adding the items to the listview.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Dont use your code. use the code in post 6 and it will work...Comment rest of the code and then try...
I have already tried it as stated above! I receive an "Invalid procedure call or argument" on the "Set" line.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
NW: It works on my end... Can you upload your App. Let me test it myself for a faster resolution...
Sure! Here it is.
Edit:
Uploaded an update of the attachment that was posted here to post #34.
Last edited by Nightwalker83; Sep 2nd, 2010 at 02:33 AM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
I just tried it but didn't notice any difference! Why do it that way?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
I just tried it but didn't notice any difference! Why do it that way?
I posted without testing it but when I tried your code it is also working and VB6 does not complain, its my first time to see such code and thought it was wrong, I'm sorry.
Regards,
™
As a gesture of gratitude please consider rating helpful posts. c",)
NW: When I tried it. It is asking me for a missing reference. Which reference are you using?
Sid
You will need to download the pop component from the link posted here, the We Only Do link and install the component and add a reference to it in the project.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
On the right-hand side of the page is a toolbox one of the options is to download the evaluation version of the component.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
This might sound funny to you but I am unable to find the wodPop3.dll on my pc... lolzzz
I have already downloaded and installed it...
Check the "System 32" (Vista/Win7) or whichever the folder is on the other Windows operating systems.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
sid, if you have installed the component, then check for this name in your components window: WeOnlyDo! COM Pop3 Client Component
Cool company name
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Ok Try this... In your Class1.cls remove the existing code and copy and paste the below...
Code:
Option Explicit
Dim MsgCount As Integer
Private WithEvents Pop3 As wodPop3Com
Public Sub Connection()
Select Case Trim(Form1.cboHost.Text)
Case "Gmail"
With Pop3
.HostName = "pop.gmail.com"
.Login = ""
.Password = ""
.Port = 995
.Connect
End With
Case "Other"
With Pop3
.HostName = ""
.Login = ""
.Password = ""
'.Port = 110
.Connect
End With
End Select
End Sub
Private Sub Pop3_Connected()
Form1.Caption = Form1.Caption & " " & "You have " & MsgCount & " new messages!"
Pop3.Messages.GetAll
End Sub
Private Sub Pop3_StateChange(ByVal OldState As WODPOP3COMLib.StatesEnum)
Form1.Caption = Pop3.StateText
Debug.Print Pop3.StateText
End Sub
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, _
ByVal HeadersOnly As Boolean)
Dim i As Integer, itmM As ListItem, lstCount As Long
For i = 1 To Pop3.Messages.Count
Set itmM = Form1.LstNewMail.ListItems.Add(, , Pop3.Messages(i).From)
lstCount = Form1.LstNewMail.ListItems.Count
Form1.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Subject
Form1.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Date
Next i
End Sub
Private Sub Class_Initialize()
Set Pop3 = New wodPop3Com
End Sub
Private Sub Class_Terminate()
Set Pop3 = Nothing
End Sub
See if this works...
Last edited by Siddharth Rout; Aug 31st, 2010 at 03:26 PM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
I receive an "Invalid procedure call or argument" error:
Code:
Set itmM = Form1.LstNewMail.ListItems.Add (, , Pop3.Messages(i).Form)
However, comparing that code with the last code in post #4 the line is the same.
Edit:
This code works! For some strange reason it didn't like the "For" statement.
Code:
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, ByVal HeadersOnly As Boolean)
'Retrieve mail from inbox
'Ín-order to view information correctly make sure the view property for LstNewMail is set to Report.
Dim i As Integer, itmM As ListItem, lstCount As Long
Do Until i = Pop3.Messages.Count
Set itmM = Form1.LstNewMail.ListItems.Add(, , Pop3.Messages(i).From)
lstCount = Form1.LstNewMail.ListItems.Count
Form1.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Subject
Form1.LstNewMail.ListItems(lstCount).ListSubItems.Add _
, , Pop3.Messages(i).Date
i = i + 1
Loop
End Sub
Last edited by Nightwalker83; Sep 1st, 2010 at 02:57 AM.
Reason: Fixed spelling!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
For once forget all your existing code. Forget your code which is in post 4 or any other posts in this thread...
Yes, I did! I received the error posted in my previous post. I think it might be a problem with my Visual Basic installation since you aren't experiencing the same problems as I am when we both run the EXACT same code.
Edit:
I receive the same error as I did running the below code but in that case it was complaining that "i" had no value so I set a value for "i" and the problem resolved itself.
Originally Posted by chelledon
private Sub Command1_Click()
Dim x As Integer, ng As Integer, b As Integer, counter As Integer
Dim z As String, y As String, char1 As String, str1 As String
z = 0
For x = 1 To Len(Text1.Text)
y = Mid(Text1.Text, x, 1)
If (y) = "ng" Then
z = z + 1
Label.Caption = z
End If
Next
counter = 0
str1 = Text1.Text
For b = i To Len(str1)
char1 = char1 + Replace(str1, char1, "", i)
Form1.Caption = Form1.Caption + char1
Next
End Sub
Last edited by Nightwalker83; Sep 1st, 2010 at 02:37 AM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
No! Sorry, that was a typo. Just tried your code by copying and pasting the code exactly how it appears in your post into my project and the above error happened.
Edit:
The only part that was missing from your code and why the error was occurring was this piece of code just before the "Next".
Code:
i = i + 1
Last edited by Nightwalker83; Sep 1st, 2010 at 04:42 AM.
Reason: Fixed spelling!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
NW, In a FOR loop, the counter variable is automaically incremented by 1 (default). There is no need of incrementing it by yourself !
Originally Posted by http://www.vb6.us/tutorials/understanding-do-and-while-loops
By default, the variable used in the declaration of the For-Next loop is incremented by 1 each time through the loop; however, if you want to increment this value by a different amount each time through the loop, you can simply append Step (Integer) to the end of the For-Next loop declaration.
...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
NW, In a FOR loop, the counter variable is automaically incremented by 1 (default). There is no need of incrementing it by yourself !
Yeah, I know! However, for some reason it does not increment the value automatically.
Edit:
Although, the code using a "For" statement in my original post works as it should.
Edit:
I just tried this code and it works! I reckon the "done" event of the pop component is causing the problem or maybe I need to download the component again.
vb Code:
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 10
Me.Caption = LstNewMail.ListItems.Add(, , i)
Next i
End Sub
Last edited by Nightwalker83; Sep 1st, 2010 at 07:11 AM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
I revisited the link that you gave above... Well there is some misunderstanding probably on my part... I was using a different link till now
I have attached my project using your code below.
Edit:
@ koolsid,
Did you get a chance to test the file I uploaded above?
Last edited by Nightwalker83; May 15th, 2011 at 11:20 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
No NW. I have been pretty busy with my office work but will do it today evening
Ah ok! I suppose there is no rush to do it now since I have resolved the original question. However, I would like to find out why the variable value wasn't being initialized in the code.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672