Results 1 to 8 of 8

Thread: Visual Basic book recommendation

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2019
    Posts
    3

    Visual Basic book recommendation

    Hello, everyone.

    I've been lurking on this site for years, primarily for your collective wisdom of VB6. I never joined but it's a good bunch of knowledgeable folks and I decided I wanted to be a part of of it and perhaps, from time to time, make a small contribution.

    Recently, I decided to discard the old and learn the new, in other words, put VB6 aside and learn Visual Basic (aka VB.net or whatever it's called these days). I have been surprised at the lack of books on Visual Basic, especially at the intermediate level.

    I would appreciate any book recommendations you might have.

    I work with "large-ish" CSV files (100+ rows, 1400+ columns) which I parse into 2-dimensional arrays. I then manipulate various fields from which I create text and html files for display. I have just read James Foxall's book, "Visual Basic 2015 in 24 hours" and there's nothing helpful in that book for what I do.

    It was easy back in the good ol' days of the VB6 and the Variant data type. It's not so easy anymore with Visual Basic. (I'm dating myself, right?) Would really like a good intermediate text book.

    Mick

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,347

    Re: Visual Basic book recommendation

    I haven't used a book for years and haven't kept track of what's available, so I can't answer that question directly. What I can say is that you should almost certainly not be using a 2D array. They have their place but should only be used when you're dealing with a genuine matrix, i.e. when every element is a genuine peer. If you have a situation where logical rows represent records and logical columns represent fields within those records, 2D arrays are the wrong choice. In such situations, you could use a DataTable, which is a .NET representation of a database table, or you could define your own dedicated type to represent a record and then create a 1D array or collection of instances of that type. For reading CSV files, you might want to go with the TextFieldParser class.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,481

    Re: Visual Basic book recommendation

    Even if you discard everything JM tried to tell you, the Variant datatype was obscurely replaced by the Object datatype. You know about type casting, right? All those old vb6 CInt, CLng, CStr, etc... They still work for type casting Objects

  4. #4
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: Visual Basic book recommendation

    I use the TextFieldParser class as mentioned by jmc. Here is a simple example of stuffing data from CSV into a database (note: for longer files it's quicker to use bulk load commands if able):

    Code:
    Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(dPath & "tcatno.txt")
        MyReader.TextFieldType = FileIO.FieldType.Delimited
        MyReader.SetDelimiters(",")
        Dim currentRow As String()
        Dim grpid, catid, description As String
        While Not MyReader.EndOfData
            Try
                currentRow = MyReader.ReadFields()
                grpid = currentRow(0).Trim
                grpid = "0000" & grpid
                catid = currentRow(1).Trim.PadLeft(6, "0"c)
                description = Replace(currentRow(2), "'", "").Trim
    
                cmd.CommandText = "INSERT INTO " & dbName & ".category(grpid, catid, descrip....
                cmd.ExecuteNonQuery()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End While
    End Using
    There are plenty of books out there but most are pretty old. Perhaps see what your local library has or just browse at a bookstore. I wouldn't expect many to cover CSV processing if it all. Arrays are generally frowned on in .Net unless perhaps you know their size in advance.

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,043

    Re: Visual Basic book recommendation

    Introductory books are easy. Those can cover data types, syntactical things like If and For, error handling, hopefully some debugging techniques, and so forth. Intermediate books are nearly impossible. The problem is that the basics are fairly narrow, and suitable for a book. Once you have those basics covered, though, the number of potential topics explodes in size to encompass nearly all of programming. I have a book on just the subject of threading that is at least as large as introductory books on VB.NET. It covers one particular subset of a subject, and lacks nothing in terms of size or weight. Even larger books could be written on broader topics like graphics, file handling, and certainly database actions. Furthermore, the number of such topics is probably almost uncountable. This tends to be true in pretty nearly any technical field, too, which is why there are loads of introductory books in any field, but the number of intermediate or advanced books tends to be small or narrowly focused on specific sub-domains of the field.
    My usual boring signature: Nothing

  6. #6
    Lively Member Grant Swinger's Avatar
    Join Date
    Jul 2015
    Posts
    71

    Re: Visual Basic book recommendation

    Have a look at CsvHelper.

    I haven't used it myself but I know people who swear by it.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2019
    Posts
    3

    Re: Visual Basic book recommendation

    While my search has in no way been exhaustive, "Murach's Visual Basic 2015" by Anne Boehm is the best "immediate" level book I've found so far at a reasonable price. I also have "Visual Basic 2008 How To Program" by the Deitels which is good. I would have preferred the newer edition but for a hobbyist, it was too expensive.

    Also, following the recommendation of jmc and others on this forum, I have moved away from arrays to data tables and views, which I've found easier to work with. My "education" and project are both progressing satisfactorily. I appreciate everyone's input. Thank you.

    Mick

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Visual Basic book recommendation

    I too have not bought a book on coding for a very long time now. I think the last ones I bought were For VB.Net, ASP.Net and ADO.Net but all of these were around the time VB 2003 was released or maybe a little before.

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