|
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
|
|
|
|
|
There are only last, first, and middle initial. The even spacing was a typo. I pasted directly from the text file but the spacing didn't stay for some reason. Please look at my reply to the post using the actual spacing issues I encountered.
Thanks for your reply!
|
|
|
|
|
My code will still work since it does not matter how many spaces tere are between the data columns and also the middle initial/name does not exists for some entries but does for others.
...Steve
|
|
|
|
|
hi.
advanced programmer, but new to vb.net.
can anyone recommend a control or know which one microsoft word uses for it's document window?
same one as in vb.net's code editor window.
eg. you type incorrect spelling in this control and it underlines errors, colors your text, adds spaces for your code, etc.
like some really advanced textbox control, what is it?
cheers all and look forward to all your suggestions
--Graham
|
|
|
|
|
HeroRaven wrote: can anyone recommend a control or know which one microsoft word uses for it's document window?
Word uses its own proprietary control for its "text editor"
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
You could try the one that comes with QueryCommander. It looks very similar to the VS.NET IDE. Might do something that Word can, but I have not messed with it much. http://sourceforge.net/projects/querycommander
The network is down...let's go get bagels.
|
|
|
|
|
do you really believe MS Word were programmed with VB.NET ?????
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
it's not one control. you can try to implement all the things by yourself. for example, for spell check, there is aspell, etc...
|
|
|
|
|
yeah i know that but for changing text in the textbox in realtime, putting color underlines, etc.
and yeah microsoft announced a few years back ms word was programmed in vb. so i'm pretty sure the new versions were too.
|
|
|
|
|
I have a program that handles my DVD collection. It is a VB.net front-end with an Access dB. I am trying to load a picture (dvd covers) into the dB. I want to be able to save a bitmap or jpeg for each record. I have the load option down but my program won't save into the database. I click the save button and nothing happens. The save option has worked fine until I added this section of code.
In the dB, the picture column is a OLE Object and when I did my dB connection in VB.net, the schema showed that the picture column was a base64binary. After running some test, it seems one line of code is causing this problem but I don't know what to put there. It is in the data binding code where I have "picDVD.DataBindings.Add("long", dsDVD, "DVD.Cover Pic")". The quotations around long is what I don't know what to use. I am uncertain of what datatype of for base64binary.
Does any of this make sense? If so, any advice would be greatly appreciated! Thank you.
Jason
I'd rather have a bottle in front of me than a frontal lobotomy.
|
|
|
|
|
|
I am new to VB.net but have a need to send secure data from my web site to another web site and then they will return data to me. What is the best way to handle this ?
Thanks
|
|
|
|
|
You could start with the HttpWebRequest and HttpWebResponse classes in System.Net; these allow you to interact directly with a site via HTTP.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
|
in VB how can we can get the code of the .exe file generated if we loose the source file??
|
|
|
|
|
|
Can someone help me how can I set my transparent form so I can click through it. if there is an icon behind my form (on Desktop for example), and I click, so the icon clicked....
OmarMallat
|
|
|
|
|
If it got it right, you have to do this:
public const int HTTRANSPARENT = -1;
public const int WM_NCHITTEST = 0x84;
protected override void WndProc(ref Message m){
if (m.Msg == WM_NCHITTEST){
m.Result = new IntPtr(HTTRANSPARENT );
}
else {
base.WndProc(m);
}
} I do something like this in a sort of custom ToolTip class.
EDIT: kut wrong forum
Public Const WM_NCHITTEST As Integer = 132
Public Const HTTRANSPARENT As Integer = -1
Protected Overrides Sub WndProc(ByRef m as Message)
If (m.Msg = WM_NCHITTEST)
m.Result = New IntPtr(HTTRANSPARENT )
Else
MyBase.WndProc(m)
End If
End Sub
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
-- modified at 16:51 Saturday 29th October, 2005
|
|
|
|
|
Thanks, but I need a VB.NET Code.. if it's possible.
OmarMallat
|
|
|
|
|
Just modified it
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Sorry, but I'm too poor in C++ or C#.
OmarMallat
|
|
|
|
|
I already edited my first post...
Seems to me you missed it.
[Marc] wrote:
EDIT: kut wrong forum
Public Const WM_NCHITTEST As Integer = 132
Public Const HTTRANSPARENT As Integer = -1
Protected Overrides Sub WndProc(ByRef m as Message)
If (m.Msg = WM_NCHITTEST)
m.Result = New IntPtr(HTTRANSPARENT )
Else
MyBase.WndProc(m)
End If
End Sub
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
-- modified at 17:03 Saturday 29th October, 2005
|
|
|
|
|
Thank you very very much, but can you complete your help and let me know how to use it. should this sub handle anythings??? when this sub was called???
sorry for your time....
and thanks again
OmarMallat
|
|
|
|
|
The WndProc sub has to do with the unmanaged Windows world. The Control class (from wich Label, Form etc are derived) is actually a kind of wrapper around the windows from Windows (now you know why it's called Windows ). When something happens to such a window, WndProc gets the message. Then, according to the message, it calls the right Method.
For example, if you press the left mouse button on a Label, WndProc gets some messages. First the WM_NCHITTEST message (WM is for Window Message). that asks what kind of surface is below the mouse. HTTRANSPARENT means 'Just click right trough me'. HTCLIENT means something like 'Give me (= the control/window) more mouse messages', and then WndProc gets those, for example WM_LBUTTONDOWN. When Control.WndProc gets the WM_LBUTTONDOWN notification, it calls the OnMouseDown method, and that method raises the MouseDown event.
Public Class ClickThroughForm
Inherits Form
Private Const WM_NCHITTEST As Integer = 132
Private Const HTTRANSPARENT As Integer = -1
Protected Overrides Sub WndProc(ByRef m as Message)
If (m.Msg = WM_NCHITTEST) 'If Windows asks what kind of surface the mouse is on
m.Result = New IntPtr(HTTRANSPARENT) 'Return that the mouse should go right through me
Else
MyBase.WndProc(m) 'Windows wants something else, let the base Control class do the work
End If
End Sub
End Class
Maybe i'll write an article about this
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
I used it.
it stop click on the form, but it didn't click through it.
OmarMallat
|
|
|
|