Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Need Help Creating a List

Hello
I am trying to create a member directory one where you click add new member, then input all of their information then click okay and have it appear on a list under the correct collumns and also have it save to an .ini file. I have the new member button all figured out, but i cant seem to make it so the information entered in the new member screen appears on the list.
Can anyone please help me? Or lead me to an example>?
[440 byte] By [Mister Purple] at [2007-11-11 10:03:27]
# 1 Re: Need Help Creating a List
What type of control are you using to display the list?
Phil Weber at 2007-11-11 17:23:19 >
# 2 Re: Need Help Creating a List
Basically what im trying to do is create a system for a game arcade company to use. So far i have sucessfully created lists for reservations and active players using these codes to imput the data into the list:

Public Function AddReservation(t, n, s, p, tb, notes)
Dim i As Integer
With Main.lst
i = .ListItems.Count + 1
tme = FormatDateTime(t, vbLongTime)
.ListItems.Add , , Left$(tme, Len(tme) - 6) & Right$(tme, 3)
.ListItems(i).ListSubItems.Add , , n
.ListItems(i).ListSubItems.Add , , s
.ListItems(i).ListSubItems.Add , , p
.ListItems(i).ListSubItems.Add , , tb
.ListItems(i).ListSubItems.Add , , notes
End With
End Function

and

Public Function LoginPlayer(t, n, num, phn, st, notes)
Dim i As Integer
With Active.lst1
i = .ListItems.Count + 1
tme = FormatDateTime(t, vbLongTime)
.ListItems.Add , , Left$(tme, Len(tme) - 6) & Right$(tme, 3)
.ListItems(i).ListSubItems.Add , , n
.ListItems(i).ListSubItems.Add , , num
.ListItems(i).ListSubItems.Add , , phn
.ListItems(i).ListSubItems.Add , , st
.ListItems(i).ListSubItems.Add , , notes
End With
End Function

I use the tme item to display the time that the person logs in at, but when Im trying to create a member directory im using same function but without the tme, and for some reason it wont display on the list.
Any Ideas?
Mister Purple at 2007-11-11 17:24:19 >
# 3 Re: Need Help Creating a List
Phil was asking about the control , okey now clearly u use the listview which refer to MSComctl ocx .

your code is working just you need header :
try to use this at the begineng of the programme (form load say) :

With Active.lst1
.View = lvwReport
.ColumnHeaders.Add Text:="Time"
.ColumnHeaders.Add Text:="n"
.ColumnHeaders.Add Text:="num"
.ColumnHeaders.Add Text:="phn"
.ColumnHeaders.Add Text:="st"
.ColumnHeaders.Add Text:="notes"
end with
Amahdy at 2007-11-11 17:25:17 >
# 4 Re: Need Help Creating a List
Yeah I have all of the column headers figured out its just that the information wont display unless it has time in it, and i dont need time for a directory.
Mister Purple at 2007-11-11 17:26:22 >
# 5 Re: Need Help Creating a List
Okay i just figured out how to add everything now could someone direct me to a way to how to save a list to an .ini file?
Mister Purple at 2007-11-11 17:27:23 >
# 6 Re: Need Help Creating a List
API:

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

USE:
WritePrivateProfileString(SectionName, KeyField, KeyVal, FilePath)

also try to learn more about :
WritePrivateProfileSection()
WriteProfileString()
WriteProfileSection()
Amahdy at 2007-11-11 17:28:22 >