|
Great to know that you solved your problem.
The folks here are very helpful.
|
|
|
|
|
From your description, I think the lines in your CSV file are not delimited by CRLF, but only LF. That would explain why you are able to open / save in Notepad, and use the file.
HTH
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
thanks chandraram -
thought i had tried that and didnt work either. will try it again now...
|
|
|
|
|
thanks again, ChandraRam -
did try to work with the LF specification, and that is how the csv is delimited, however still getting the "input past end of file" error. my "second" code attempt, posted earlier:
...
BCMcsv = Dir$(BCMdrive & BCMtext)
Dim f1 As Long
Dim f2 As Long
Dim strLine As String
f1 = FreeFile
Open BCMdrive & BCMcsv For Input As #f1
f2 = FreeFile
Open BCMdrive & "tempBCM.txt" For Output As #f2
Line Input #f1, strLine 'ignore first line
Do While Not EOF(1)
Line Input #f1, strLine
Print #f2, strLine
Loop
Close #f1
Close #f2
...
does actually seem to work down to the "Line Input #f1, strLine" line, but it is reading the entire csv file at this point; doesnt seem to be parsing it line by line... ??
|
|
|
|
|
Not sure where you have taken into account that the delimiter is LF instead of CRLF in your code...
FYI,
Line Input
reads a line of text until it encounters a CR, which in this case is probably only at the end of the file.
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
right, apparently not in this code. was trying to work with "sLines = Split(objTXT.ReadAll, vbCvLf)" in the first code above; cant seem to get either to work right
|
|
|
|
|
dubscat wrote: "sLines = Split(objTXT.ReadAll, vbCvLf)" Should it not be vbCRLF?
Also, did you try splitting with just vbLF? If your CSV is delimited with LF, surely that should work?
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
yes, did, but was still getting the "input past end of file" error. here's the code again:
....
BCMcsv = Dir$(BCMdrive & BCMtext)
Set objFSO = CreateObject("scripting.filesystemobject")
Set objCSV = objFSO.CreateTextFile(BCMdrive & BCMcsv, True, False)
Set objTXT = objFSO.OpenTextFile(BCMdrive & BCMcsv, 1)
sLines = Split(objTXT.ReadAll, vbLf)
objTXT.Close
iNumberOfLines = UBound(sLines)
If iNumberOfLines > 1 Then
Set objTXT = objFSO.OpenTextFile(objCSV, 2) 'For Writing
For i = 1 To iNumberOfLines
objTXT.WriteLine sLines(i)
Next
objTXT.Close
End If
...Set objects = nothing ...
|
|
|
|
|
Which line errors out?
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
got it, ChandraRam:
found the "fix csv..." solution on-line; link is below. final code:
...
BCMcsv = Dir$(BCMdrive & BCMtext)
'Fix CSV file to read correctly =====================================================================
Open BCMdrive & BCMcsv For Input As #1
Line Input #1, TxtLine 'read line input, which reads entire file because no CR Chr(13), just LF Chr(10)
NewText = Replace(TxtLine, vbLf, vbCrLf) 'Find all Chr(10) LF and replace with CRLR
Close #1
Open BCMdrive & BCMcsv For Output As #1 'Open file again, but for output this time
Print #1, NewText 'use print function to write contents, but with LF replaced by CRLF
Close #1
'======================================================================================================
Open BCMdrive & BCMcsv For Input As #1
Set objFSO = CreateObject("scripting.filesystemobject")
Set objTXT = objFSO.OpenTextFile(BCMdrive & BCMcsv, 1)
sLines = Split(objTXT.ReadAll, vbCrLf)
objTXT.Close
iNumberOfLines = UBound(sLines)
If iNumberOfLines > 1 Then
Set objTXT = objFSO.OpenTextFile(BCMdrive & BCMcsv, 2) 'For Writing
For i = 1 To iNumberOfLines
objTXT.WriteLine sLines(i)
Next
objTXT.Close
End If
set objects = nothing
...
http://us.generation-nt.com/answer/vba-line-input-not-recognizing-end-line-help-198799921.html[^]
|
|
|
|
|
If this "fixed" it, I don't see why it did not work when you said you tried the "Split" function with just the vbLF...
Anyway... glad your code works OK for you now.
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
right, not sure either at this point, but is working fine now. for whatever reason, it rectified the 'input past EOF' error....
|
|
|
|
|
I'm writing an application that currently uses RSA public-key encryption. However, for users using newer computers, I want to offer the ability to use ECDH (Elliptic Curve Diffie-Hellman) as this seems to have many advantages over RSA. I've been over the MSDN articles and have tried search Google and CodeProject to figure out what I'm trying to do, but no luck.
Basically the application should do the following when starting up:
1. Check if the system supports ECDH. If it does continue on, otherwise create RSA keys.
2. Check if ECDH keys have already been created using a specified name.
2a. If the ECDH keys exist with the specified name then load them into an object to use within the application
2b. If the ECDH keys do not exist with the specified name then create ECDH keys (which I believe should be a CngKey object)
I've figure out how to make sure the ECDH keys can be created and even create them. However I can't figure out how to do the following:
1. Load the keys into an ECDH object. I check for the keys and load them like this:
If CngKey.Exist(keyName) then
Dim key as CngKey = CngKey.Open(keyName)
End If
However once I have a CngKey object how to I apply that to an ECDH object (the key property of an ECDH object is read-only)?
2. I can't seem to delete a key once it is created. I tried the following:
Dim b As Boolean = CngKey.Exists(keyName)
Dim key As CngKey = CngKey.Open(keyName)
key.Delete()
b = CngKey.Exists(keyName)
If I run the above code, the second time I check if the key exist using b = CngKey.Exists(keyName) it always return true. Reading the MSDN documentation, it seems that when you call the CngKey.Delete method, it just prevents the CngKey object from being used. How can I actually delete the key permanently? What do I need to replace key.Delete() with so when b = CngKey.Exists(keyName) is called the second time it would actually return false? Or is there no way to actually permanently delete a named key?
Any other documentation, articles, links, etc. that shows how to use ECDH in VB.NET would be greatly appreciated. In the key I'm just trying to find how to load and save ECDH keys like RSA keys, so my program has multiple options.
Thanks in advanced for any help you can provided.
|
|
|
|
|
Someone actually tell me what's the best method for deploying between clickonce and windows installing deployments methods
|
|
|
|
|
This has nothing to do with Visual Basic, please choose a more appropriate forum.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
That depends on your requirements. There is no such thing as a "best method" in all deployment cases.
|
|
|
|
|
hallo..
im sorry if my english hard to understand, because my english is not well, but i trying with my best to write in english..!!
any body can help, how to draw backround picture in windows aero theme, like in firefox with theme..
thx..
|
|
|
|
|
I have picture box control.Using picture box.Height and picture box.Width in do loop i read the pixel information.When i use large resolution image(height and width of the image is more)it hang and not respond.how rectify this or set progress bar until the loop ends.
dim i,j as integer
dim img as image
img=picturebox1.image
do(i
|
|
|
|
|
leostalin91 wrote: When i use large resolution image(height and width of the image is more)it hang and not respond.how rectify this or set progress bar until the loop ends.
Would need to be executed on it's own thread, otherwise the UI-thread does not get the chance to repaint. The easiest way to do so, and add a progressbar, is using a BackgroundWorker [^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
i think, you can add Application.doevents in u looping..
|
|
|
|
|
i think, you can add Application.doevents in ur looping..
|
|
|
|
|
That's the most dangerous way to do it as DoEvents will allow you to click other buttons and possibly make the code reentrant.
The appropriate method is to farm the work off to a background thread.
|
|
|
|
|
I agree with Dave you need to process this on a background thread so the UI can update itself.
|
|
|
|
|
Hello. I am getting this stack overflow exception.
I have tried different things like:
- making the current class Shared
- or using a counter to see if the class already has an instance?
But none of them is working for me. Here is what I am trying ( read comments as well )
Imports SomeLibrary
---------------------------------
Public Class ABC
Private WithEvents instance As New ClassName
Public Sub New()
End Sub
End Class
So how can I get better of this exception? Thanks.
This world is going to explode due to international politics, SOON.
modified 16-Oct-12 4:04am.
|
|
|
|
|
You have a circular reference somewhere; does the class 'ClassName' from imported DLL have a reference to class 'ABC'?
|
|
|
|