Results 1 to 2 of 2

Thread: Need Help With Importing .CSV Files

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    279

    Need Help With Importing .CSV Files

    Hey everyone it has been a while but I am in need of some help/advice.
    I am trying to make a manager program for business leads.

    I had some help on a load sub for a program I had been working on but that is on the backburner for now.
    The problem is the load sub was created just for that program and it was not flexible at all meaning that when loading the .csv data
    it could be a bunch of different variables that come into play such as header/no header with the .csv files, as well as different names for the header info,
    or info is rearranged differently in different files and so I would also want to be able to ignore some fields when importing the data or change the name of the csv header column.
    Also be able to add remove columns..

    so I guess to start I need some help with trying to load .csv files with and without header info, ignoring some fields when importing.
    After clicking import should I create a form that will show all the data being imported so I can add ignore column via combo box options?

    Take a look at attached image to see what I mean.. I will also need to add custom fields like in the image.

    Name:  CSV Import 01.jpg
Views: 107
Size:  26.7 KB

    I realize the image is wordpress but you get the idea..

    I am not exactly sure how I want to set this up so I am hoping to talk about it with you guys/gals.
    Like if the import .csv data is different do I want to hardcode my DataGridView Columns?
    or just be able to set options as I import each file?

    The thing is, I will eventually want to merge files together as well as split them so if they have different fields it could be an issue..

  2. #2
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,794

    Re: Need Help With Importing .CSV Files

    well I can't see anything in that Image.

    the place to start would be to read a few Lines of the CSV

    Step 1.
    does the CSV have a Header?
    Code:
     Dim CsvHeader = File.ReadLines("D:\TestFolder\TestFolderResult\NewCsvFile.csv").First()
            Debug.WriteLine(CsvHeader)
    
            'the Debug output:
            '"ID";"Name";"Number"
    so after reading the First line I know there is a Header and some clue
    as to what the Data might be (Integer;Text.....)

    what have you done sofar?
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width