|
You always need to open a file before you can read its contents.
If your data is in a fixed format, then maybe a Random Access read will do the job to retrieve the last line of data. From that you can then determine whether or not to read then entire file sequentially or load it into Excel or whatever you want.
Search for "random access file vb" in Google and on the Code Project for more info on random files in VB.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
If I'm understanding this correctly, just reading the last line won't suffice. You need to actually go through the entire file just to see if you need to do work or not.
If that's the case, use streamreader to read each line individually and do a comparison each time.
*** Untested Code below ***
<br />
Private Sub ProcessFile(ByVal nameoffile as string)<br />
Dim filereader as IO.StreamReader<br />
Dim strLine as string<br />
Dim intColumnC as integer<br />
Dim intHighestNumber as integer<br />
filereader = new io.streamreader(nameoffile)<br />
Do<br />
strLine = filereader.readline<br />
intColumnC = (add formatting to meet your file's layout to get columnC)<br />
If intColumnC > intHighestNumber then<br />
intHighestnumber = intColumnC<br />
End If<br />
Until filereader.peek = -1<br />
<br />
If intColumnC = intHighestnumber then<br />
'Add code here to process the file<br />
End If<br />
End Sub<br />
If you need to loop through the files, then you'll need to add a IO.Directory item to parse then add something liek this:
<br />
Dim fileName As String<br />
Dim files As String()<br />
Dim dirApp As String = System.AppDomain.CurrentDomain.BaseDirectory()<br />
files = IO.Directory.GetFiles(dirApp, "*.sql")<br />
For Each fileName In files<br />
ProcessFile(fileName)<br />
Next<br />
HTH
|
|
|
|
|
Hi,
Please i want to play music in ma application i want this music play in the load of the app. the music have to be an .mp3 or .rm
is it an easy way to do that ?? even if it is diffecult i will understand with a little explanation
aaah , i forgot !! the music can play just in the load of ma application i mean when i see the first form loading i want to hear that music or beep or whatever it won't be long 3 seconds 2 i don't know something like that
thank you very much
try to be good if you can't be the best
|
|
|
|
|
|
|
hey thnx but this link drives me to how to get an answear to your question it doesn't give me what i need
i need to play music in ma window application & i want to know how
thank you
try to be good if you can't be the best
|
|
|
|
|
I found out that it is createObject("NovellGroupwareSession") However, the code still does not like
Set MItem = EmailApp.createitem(0) or
Set MItem = EmailApp.createitem(olmailitem)
ANyone?
My company uses Novell Groupwise. What should I use as server and class in the following statement (in this example it uses Outlook Express)?
Set EmailApp = createObject("Outlook.Application")
My code does not like "Outlook.Application".
Is there a reference to check where the code will thinnk it is outlook while still using Groupwise?
Thanks for your help and patience...I am new at this.
Nick Iracleous
-- modified at 11:57 Wednesday 24th May, 2006
|
|
|
|
|
|
hi..
i have a problem in vb, how can i use the printer to print a data grid in my form..
can some one please help me..
areon25
|
|
|
|
|
|
|
Is this something that can be done with vb.net
something similar to pivotpro (software)
how would you persue it if you had to do it?
|
|
|
|
|
crash893 wrote: something similar to pivotpro (software)
how would you persue it if you had to do it?
Please clarify your question again.
|
|
|
|
|
Hi ,
Please i have finished my application & now i need to deploy it i have read two documents abt that but the two were not precise so i need something more clear & more explicit i really need that to get better marks in ma stage better you do better you get so can you share my succeed with me please ???
thank you very much
try to be good if you can't be the best
|
|
|
|
|
|
What I like to know is what code would I need to have if when I press a button it will tell the system to scan for new hardware? Basically the same as going into Device manager and telling it to scan for new hardware. If you ask why I'll go into more detail what I wan't to do.
P.S It's been about two years since I've done VB so I'm more then rusty on it.
Thanks,
Pat
|
|
|
|
|
Pat,
Somthing like this: (In VB.Net.)
(Imports System.Runtime.InteropServices)
Public Const CM_LOCATE_DEVNODE_NORMAL = &H0
Public Const CR_SUCCESS = &H0
Public Const CR_OUT_OF_MEMORY = &H2
Public Const CR_INVALID_DATA = &H1F
Public Const CR_INVALID_MACHINENAME = &H2F
Public Const CR_ACCESS_DENIED = &H33
<DllImport("cfgmgr32.dll", SetLastError:=True)> _
Public Shared Function CM_Locate_DevNode( _
ByRef pdnDevInst As IntPtr, _
ByVal pDeviceID As String, _
ByVal ulFlags As Integer) _
As Integer
End Function
<DllImport("cfgmgr32.dll", SetLastError:=True)> _
Public Shared Function CM_Reenumerate_DevNode( _
ByVal dnDevInst As IntPtr, _
ByVal ulFlags As Integer) _
As Integer
End Function
Private Function ScanForHardwareChanges() As Boolean
Dim status As Integer
Dim hDevInst As IntPtr
status = CM_Locate_DevNode(hDevInst, vbNullString, CM_LOCATE_DEVNODE_NORMAL)
'Debug.WriteLine("CM_Locate Status: " & status)
If status <> CR_SUCCESS Then
Return False
End If
status = CM_Reenumerate_DevNode(hDevInst, 0)
'Debug.WriteLine("CM_Reenumerate Status: " & status)
If status <> CR_SUCCESS Then
Return False
End If
Return True
End Function
Progload
|
|
|
|
|
Thankyou very much. Now lets see if I can actually do something with this. =)
|
|
|
|
|
My form has a BindingSource object which was added using the Form Designer with the AllowNew property set to True and the DataSource property assigned to a typed DataSet. The typed DataSet has some default column values.
When the form loads I call 'Me.SharedBindingSource.AddNew()' so as to have a single row of data with the default column values ready for displaying on forms. However, on calling the method I always get a System.NotSupportedException.
I have used this before but I cannot tell why it is not working this time around.
Exception details:
System.NotSupportedException was unhandled by user code
Message="Specified method is not supported."
Source="System.Data"
StackTrace:
at System.Data.DataViewManager.System.ComponentModel.IBindingList.AddNew()
at System.Windows.Forms.BindingSource.AddNew()
at WinPresentationLayer.StartForm.StartForm_Load(Object sender, EventArgs e) in D:\WinPresentationLayer\Forms\StartForm.vb:line 15
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Thanks
Mark
|
|
|
|
|
I discovered that the exception was raised because I had not yet assigned a value to the BindingSource.DataMember property.
I had intended/hoped that AddNew() would add a new row to each DataTable in the DataSet but obviously it only acts upon the assigned DataMember.
|
|
|
|
|
How do I create an install program. My program is written in 2003.net and want to run it on a machine that does not have VB loaded on it.
Any ideas? In VB6 I could create an install program? How do I do that in 2003
|
|
|
|
|
You only need to install .NetFrameworkRuntime (dotnextfx) file on the destination machine. You may use a third party installer, This is the case I always do, I don't know much about Setup projects.
|
|
|
|
|
|
how can i add a string to calendar at a day specific
exmple:
add( calender ,date,string )
thanks
dadax
|
|
|
|
|
i need some sample .net projects.
plzzzzzz tell me some good websites.
|
|
|
|