Click here to Skip to main content
15,915,600 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Printing a Form in VB.net Like Access 2000 Pin
Rich Locus30-Oct-05 15:42
Rich Locus30-Oct-05 15:42 
AnswerRe: Printing a Form in VB.net Like Access 2000 Pin
Christian Graus30-Oct-05 16:01
protectorChristian Graus30-Oct-05 16:01 
QuestionInvalidate and Flicker Pin
rwestgraham30-Oct-05 13:51
rwestgraham30-Oct-05 13:51 
AnswerRe: Invalidate and Flicker Pin
Christian Graus30-Oct-05 14:39
protectorChristian Graus30-Oct-05 14:39 
GeneralRe: Invalidate and Flicker Pin
rwestgraham30-Oct-05 16:22
rwestgraham30-Oct-05 16:22 
QuestionRead From Text File Pin
kenexcelon30-Oct-05 11:23
kenexcelon30-Oct-05 11:23 
AnswerRe: Read From Text File Pin
kenexcelon30-Oct-05 11:27
kenexcelon30-Oct-05 11:27 
AnswerRe: Read From Text File Pin
Steve Pullan30-Oct-05 12:30
Steve Pullan30-Oct-05 12:30 
Looking at the data it seems that a space character separates the various columns of data. The exception though is that the first name can contain more than one name (i.e. the student's middle names as well). That's the trick to parsing this data.

The code you have should work with the addition of detecting the number of first and middle names. To that end I'd inspect the value of UBound(ar). For a person with no middle name the UBound should be = 9, with one middle name = 10, with two middle names = 11 and so on.

You could use this information to set a variable as the index to the ar() string array and automatically capture the data columns viz:

With stud
    .Number = CType(ar(0), Integer)
    '.Last = CType(ar(1), String).Substring(0, .Last.Length - 1)
    'Fix above parsing error
    .Last = CType(ar(1), String)
    .First = CType(ar(2), String)

    ' Determine the index of the middle name if it exists.
    ' This logic will need to be changed slightly if multiple
    ' middle names are expected in the data.
    Dim n As Integer
    n = UBound(ar) - 9

    If n = 0 Then
        .MidI = vbNullString ' or "" depending on your requirments
    Else
        .MidI = CType(ar(3), String)
    End If

    .ID = CType(ar(n + 3), String)
    .College = CType(ar(n + 4), String)
    .Classification = CType(ar(n + 5), String)
    .Email = CType(ar(n + 6), String)
    .Major = CType(ar(n + 7), String)
    .Paid = CType(ar(n + 8), String)
    .Enrolled = CType(ar(n + 9), String)
End With

There are several assumptions in the above code, but you should get the idea how it works.


...Steve
GeneralRe: Read From Text File Pin
kenexcelon31-Oct-05 4:14
kenexcelon31-Oct-05 4:14 
GeneralRe: Read From Text File Pin
Steve Pullan31-Oct-05 13:37
Steve Pullan31-Oct-05 13:37 
Questionwhat control does Word use for its texteditor? (like advanced rich textbox?) Pin
HeroRaven29-Oct-05 19:05
HeroRaven29-Oct-05 19:05 
AnswerRe: what control does Word use for its texteditor? (like advanced rich textbox?) Pin
Colin Angus Mackay30-Oct-05 5:06
Colin Angus Mackay30-Oct-05 5:06 
AnswerRe: what control does Word use for its texteditor? (like advanced rich textbox?) Pin
Moonark30-Oct-05 10:28
Moonark30-Oct-05 10:28 
AnswerRe: what control does Word use for its texteditor? (like advanced rich textbox?) Pin
toxcct31-Oct-05 0:34
toxcct31-Oct-05 0:34 
AnswerRe: what control does Word use for its texteditor? (like advanced rich textbox?) Pin
cynferdd31-Oct-05 0:37
cynferdd31-Oct-05 0:37 
GeneralRe: what control does Word use for its texteditor? (like advanced rich textbox?) Pin
HeroRaven31-Oct-05 12:46
HeroRaven31-Oct-05 12:46 
QuestionVB.net and Access dB Pin
JMS7629-Oct-05 14:44
JMS7629-Oct-05 14:44 
AnswerRe: VB.net and Access dB Pin
KaptinKrunch31-Oct-05 2:07
KaptinKrunch31-Oct-05 2:07 
QuestionPassing Data between different web sites Pin
john_paul29-Oct-05 11:48
john_paul29-Oct-05 11:48 
AnswerRe: Passing Data between different web sites Pin
John Kuhn30-Oct-05 10:05
John Kuhn30-Oct-05 10:05 
GeneralRe: Passing Data between different web sites Pin
john_paul30-Oct-05 14:13
john_paul30-Oct-05 14:13 
QuestionHow to get the code of .exe file Pin
maheshreddy_iiith29-Oct-05 10:49
maheshreddy_iiith29-Oct-05 10:49 
AnswerRe: How to get the code of .exe file Pin
rwestgraham29-Oct-05 11:27
rwestgraham29-Oct-05 11:27 
QuestionClick throught a form Pin
Omar Mallat29-Oct-05 10:20
professionalOmar Mallat29-Oct-05 10:20 
AnswerRe: Click throught a form Pin
[Marc]29-Oct-05 10:51
[Marc]29-Oct-05 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.