I'm making a windows form modul (from excels visual basic) which has various elements like "Author", "year of publication", "Title" and "Category"
The task is, that after the user given a Value to every of these element theres a button, which saves them into a list, and deletes all the data that has been written into the elements (like the title name category etc)
That was the first part of the main task.
The secont part, is that I have to export the list content into a file, which is not a problem, instead the problem is that I have to export them in a given format!
For example its exports it with my solution like this: (every element is in a new line)
Author name
Books name
Year of publication
Category
Each of the in a new line, but I have to export then in this formation: (every element is in one line, but if I record a new one it should be in a new line like below)
Author name1;Books name1;Year of publication1;Category1;
Author name2;Books name2;Year of publication2;Category2;
I just can't figure it out how to do this!
Here's my code snippet from the export button:
What you have to know about this is :
lista = ListBox1
Code:Private Sub CommandButton_export_Click() Dim i As Integer Open "D:\export.txt" For Append As #1 For i = 0 To lista.ListCount - 2 lista.Selected(i) = True Print #1, lista.List(lista.ListIndex) & ";" 'lista.List(lista.ListIndex) Next Close #1 lista.Clear End Sub


Reply With Quote


