Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 3rd, 2005, 06:56 AM
sanjanah_verma sanjanah_verma is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 190 sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 7 h 16 m 13 sec
Reputation Power: 6
Read a fixed length file in VB

Hi,

Can anybody tell how to read a fixed length text file using VB code????? I want to read the data in that file and insert it into a database. Can anybody help me how to do this?

Reply With Quote
  #2  
Old March 3rd, 2005, 10:52 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 28 m 48 sec
Reputation Power: 180
Here is one place to start your search for information

http://msdn.microsoft.com/library/e...eProcessing.asp
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old March 4th, 2005, 10:12 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Code:
Open [File and Path Name] For Input As #1

Do While Not EOF(1)

    Line Input #1, s
        
    VAr1= Trim(Mid(s, 1, 20))
    var2= Trim(Mid(s, 21, 20))


'Continue with your process

Loop


S-
__________________
If you have found a particular post helpful, show your appreciation by adding reputation points to that user by clicking the "scales" image in the upper right had corner of their post.

Reply With Quote
  #4  
Old March 4th, 2005, 01:21 PM
tigersolv tigersolv is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: between Wigan and Bolton
Posts: 2 tigersolv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 16 sec
Reputation Power: 0
Lightbulb reading in text files

Try using the File scripting objects, they are a lot more controllable and stable than just opening and reading files

Include the microsoft scripting Runtime in your project and away you go.

Reply With Quote
  #5  
Old March 4th, 2005, 02:52 PM
Darius Darius is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 108 Darius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 16 m 54 sec
Reputation Power: 4
Read
http://www.hackeralliance.net/publi...o/devilz/07.htm

Or more or less...

Dim AA As String * 10
Private Sub Command1_Click()
Open "C:\Test.txt" For Random As #1 Len = 10
Get #1, 1, AA
Close #1
MsgBox AA
End Sub

if you want to write use Put insteed of Get.

Reply With Quote
  #6  
Old March 22nd, 2005, 10:58 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Quote:
Originally Posted by tigersolv
Try using the File scripting objects, they are a lot more controllable and stable than just opening and reading files

Include the microsoft scripting Runtime in your project and away you go.



I have done some looking into microsoft scripting Runtime. It seems everything I have read says this is slower and you are better off using the regual I/O for test files

Any comments. Would like to hear from others who have use the microsoft scripting Runtime.

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Read a fixed length file in VB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway