Start New Discussion within our Software Development Community

ok heres the deal
i am writing a yahoo program that requires you to load a file from your computer, so i put THIS source in for the load button to open a common dialog box for file selection:

On Error Resume Next
If Command13.Caption = "Load Bots" Then
Dim LTD As String, f As Variant, x As Integer
Set Header1 = ListView3.ColumnHeaders.Add(, , "", 250)
Set Header1 = ListView3.ColumnHeaders.Add(, , "Id", 1900) '1
Set Header1 = ListView3.ColumnHeaders.Add(, , "Pass", 1000) '2
f = FreeFile
With CD1
.FileName = ""
.DialogTitle = "Load bots List"
.Filter = "All Supported Types|*.txt"
.ShowOpen
If CD1.FileName = "" Then Exit Sub
Open CD1.FileName For Input As #f
While Not EOF(1)
Input #1, LTD
f = Split(LTD, ":")
If x < 2000 Then
Set Item = ListView3.ListItems.Add(, , , , 1)
Item.SubItems(1) = f(0)
Item.SubItems(2) = f(1)
x = x + 1
lblStatus.Caption = ".......Loading......."
DoEvents
End If
Wend
Close #1
ListView3.View = lvwReport
End With
End If

now here's the problem, i keep getting a compile error when i go to test it and i hit that load button regarding the .ColumnHeaders part of the code. the error says method or data member not found. i dont know if it is my VB6 or if it is me or wat it is...if someone is willing to help me on it, i would really appreciate it :cool:

No. No problem. The syntax is:

ColumnHeaders.Add([Index], [Key], [Text], [Width], [Alignment], [Icon])

so your code leaves Index and Key to default values and gives Text and Width values. And that's correct.

What was the exact error message? Do you have variable Header1 Dimmed somewhere?

This article has been dead for over six months. Start a new discussion instead.