Results 1 to 5 of 5

Thread: [RESOLVED] Selecting Column and position to read data from

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2010
    Location
    Sunny Surrey (near a small town called London).
    Posts
    38

    Resolved [RESOLVED] Selecting Column and position to read data from

    Hi,

    I would normally select the column I read data from - strline(3),

    and where I start reading in a string from - Mid (sLine, 12, 10),

    How do I combine the two?

    And to further complicate it, the length shown here (10) will vary in length and I want to concatenate another column on the end - & " " & Trim(Strline(4)).

    Thanks

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Selecting Column and position to read data from

    Can you provide more details with examples and the code you are using....? ...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2010
    Location
    Sunny Surrey (near a small town called London).
    Posts
    38

    Re: Selecting Column and position to read data from

    I'm not sure my coding would help (its that bad),

    Basically data in
    Column 2 is: 123......ABC;
    Column 4 is: XYZ;

    Both columns declaired as strings,

    I want to take the ABC out of column 2 anc concatinate the XYZ on the end.

    Previously if I wanted data input from column 2 it would be using

    .Answer = strline(2)
    Which would input everything in the column, but this time I want to only include from char 10
    And I would repeat this in a loop of +1 till the end of file

    Or if I wanted to read data from a string starting at a certain place it would be

    .Answer = Mid(sLine, 15, 3) 'Assuming the XYZ started at the 15th character
    And again repeat till end of file.

    Looking to mix it so this time:

    .Answer = Trim(strline(2), sline, 10) & " " & Trim(strline(4)) 'Assuming XYZ is in column 4

    And again loop with +1 till end of file.

    Does that make sense or have I made things worse???

    Thanks

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Selecting Column and position to read data from

    Are you using a Listview...??? Or a String array, where all the lines will be stored...???

    Mid(sLine,15) --> This will give you the string starting from the position 15 till the end of the line. ...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2010
    Location
    Sunny Surrey (near a small town called London).
    Posts
    38

    Re: Selecting Column and position to read data from

    Thanks for your help, this gives me the answer. It was just trying lots of things till I found the result. This starts from the 15th character of the second column.

    .CatCode = UCase(Mid(strline(2), 14) & " " & Trim(strline(10)))

    Thanks

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