English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi, I'm a real beginner to VB so I'd appreciate the answers to be in simplistic form please! Basically, I need to know the code for getting items out of the listview.
I would like to write out, in an txt file, for the amount of items in the listview, the subitems of each item (if that makes sense?) I'm going to add the code as an EDIT as it doesn't seem to format it properly on here.


Thanks in advance for your answers!

2007-02-24 12:56:20 · 1 answers · asked by dieselpower96 2 in Computers & Internet Programming & Design

for i = 0 to (frmMainWindow.listview1.items.count)

for c = 0 to 9

CSVStream.Write(frmMainWindow.ListView1.items(i, c)
next
next

CSVStream.Close()

2007-02-24 12:56:48 · update #1

1 answers

content=//adding a new node at any place in a linked list
//acording to users choice

#include
#include
#include
#include

struct abc
{
char n[20];
int p;
abc *next;
};
void main()
{
clrscr();
int c=0,per;
abc *list,*start=NULL,*ptr,*prev;
char nm[20],flag;
cout<<"enter the name and percentage marks of five children ";
for(int i=0;i<=4;i++)
{
if(start==NULL)
{
ptr=new abc;
cout<<"enter the details :";
cin>>ptr->n>>ptr->p; // the name and percantage of the students is entered
start=ptr;
prev=ptr; //start=ptr=prev
}
else //implemented 4 times
{
ptr=new abc;

cin>>ptr->n>>ptr->p;
prev->next=ptr;
prev=prev->next;
}
}
int ch;
cout<<"\n enter the choice where the record is to be inserted \n";
cout<<"\n 1. starting of the list ";
cout<<"\n 2. in between ";
cout<<"\n 3. at the end";
cin>>ch;
list=new abc; // till now we were using prt and now list is used
cout<<"\n enter the name and percent of new student :";
cin>>list->n>>list->p; // which is to be inserted

if (ch==1) // 1st option
{
list->next=start;//cin>>list->n>>list->p;---> will enter the element in the list and after making list->next=start that element will become the first because start is it's next
start=list;//now making list the starting point
}
else if(ch==3) //3rd option
{
ptr=start;
while(ptr!=NULL)
{prev=ptr;
ptr=ptr->next; //once again to find the last node
}
prev->next=list;//adding at the end.
list->next=NULL;//making end NULL
}
else //2nd option in between
{
cout<<"\n enter the record number (2-4) after which the node is to be inserted";
cin>>c;
if (c==1 || c==5)
{
cout<<"sorry wrong no. entered ";
exit(0);
}

i=0 ;
//insert the node
ptr=start;
cout<<"\n"<<"the list is :\n";
cout<<"name percentage\n";
while(ptr!=NULL)
{
i++;
if (i==c)//if element entered are --> a b c d e and i want to enter at 4th position then.....what will be ptr next? it will b d position which was pre-occupied by d next element , i.e, d

{ before ---> a b c d e. f is taken to be the element to be inserted, so f-->d,
list->next=ptr->next; // at 4th position means after c or at d. coz first position is before a
ptr->next=list; //and c--->f
}
ptr=ptr->next;
}
}
ptr=start;
// display all the records ;
while (ptr!=NULL)
{
cout<n<<" "<p;
ptr=ptr->next;
cout<<"\n";
}
getch();
}
don't undertand what u mean?

2007-03-01 23:35:36 · answer #1 · answered by jayati j 2 · 0 0

fedest.com, questions and answers