Delphi Listbox Save To File

Delphi Listbox Save To File Rating: 3,5/5 6321 reviews
File

Hello: I modified the code you provided (thank you) to create a csv file with 2 columns of data, the first column pulls the currently selected item in a dropdown box and the second column pulls each item in the listbox. The comma's, however are not showing up in the file - here is the code that I used:Dim sb As New System.Text.StringBuilderDim i As IntegerFor i = 0 To lboMembers.Items.Count - 1lboMembers.SelectedIndex = isb = sb.Append(Chr(34) & ddlLegSession.SelectedItem.ToString( ) & Chr(34) & ',' & Chr(34) & lboMembers.SelectedItem.To String & Chr(34) & ',' & vbCrLf)NextDim sw As New StreamWriter('c:Documents and SettingsAll UsersDocumentstest.csv')sw.Write(sb.ToString)sw.CloseI'm not sure if the comma's don't show because I use excel to open up the csv file??? Any assistance would be greatly appreciated.Gagey.

File

I want to save to.ini and after fill checklistbox items from the saved ini file. I have 2 listboxes like.First listbox contains tables:. Cars. Customers. Users. Who carry his head under his arm.

Mar 28, 2002  RE: Save listbox items to ini file. Assuming you have the INI file already created and stored in a variable called theIni var x: integer; begin theIni.EraseSection('CUSTLIST'); // To clear it first for x:= 0 to CustList.items.count-1 do begin theIni.writeString('CUSTLIST','ITEM'+intToStr(x).

Save

Delphi Listbox Save To File Download

SuppliersThe second listbox links to the first, if I click on Cars table and checked it the following datas will be visible on the second checklistbox.Second listbox contains table fields:CARS - CarID- CarName- CarLicNum- CarColor etc.USERS. UserID. UserName. UserPassword etc.Anyone can help me how can I save all the checked items (from checklistbox 1 and checklistbox2) to.ini file? And after how can I load and fill the checklistboxes with them?I did for the first checklistbox but. I guess your problem is getting your head around the fact that the contents of the second list box change, and so the risk of error is quite high.

I agree with that and so the answer is to ignore the list boxes themselves and focus on what they represent, and so store the data that the user wants to see - and in this case I would use field names for that - so ini.WriteString('File To View', 'Name', 'Cars');and for the fields ini.WriteInteger('Cars', 'Count', 2);ini.WriteString('Cars', 'Field 1', 'CarsID');ini.WriteString('Cars', 'Field 2', 'CarLICNUM');I guess that you only allow one box in the first checkbox to be checked. If that were not true, or later became not true, you would add count and 'Name x' parameters like this ini.WriteInteger('File To View', 'Count', 2);ini.WriteString('File To View', 'Name 1', 'Cars');ini.WriteString('File To View', 'Name 2', 'Users');So changing your GUI later becomes easy, as does making your new program backwards compatible. This is the point LU RD makes about basing your INI file on your business model and not your GUI.Note also the fact that you may store multiple sections - one for each file in fact, but that doesn't really matter and has the hidden benefit that the INI file 'remembers' the users last choice of fields for each file.

Posted on