home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1681
Discussions: 188,402, Posts: 2,243,609, Members: 232,632
Old May 12th, 2005, 07:04 PM   Digg it!   #1 (permalink)
The Macedonian Member
 
njolakoski's Avatar
 
Join Date: Mar 2004
Location: Macedonia Point, IN
Posts: 3,363
Send a message via AIM to njolakoski Send a message via MSN to njolakoski Send a message via Yahoo to njolakoski
Need Visual Basic Help

I need some Visual Basic help. I cant think of the code something I need for my program. When I press "Get Roster" I need it to pull all the info from a Text File and the place all the info into a Listbox, I cant think of the code Blaise helped me last night but i forgot to save the code and I lost It so I need your guys help.

TIA
__________________
Macedonia For the Macedonians! Not Greeks! Alexander The Great Is Macedonian

Moja Makedonija-Makedonija Za Makedoncite

njolakoski is offline   Reply With Quote
Old May 12th, 2005, 07:40 PM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,026
well it depends on how you did it, there's more than one way to do it .

from ADO
or using FSO
or Input as #1

vass0922 is offline   Reply With Quote
Old May 12th, 2005, 07:49 PM     #3 (permalink)
The Macedonian Member
 
njolakoski's Avatar
 
Join Date: Mar 2004
Location: Macedonia Point, IN
Posts: 3,363
Send a message via AIM to njolakoski Send a message via MSN to njolakoski Send a message via Yahoo to njolakoski
well Input as #1 but i want it to go into a Listbox

njolakoski is offline   Reply With Quote
Old May 12th, 2005, 07:51 PM     #4 (permalink)
I am a banana!
 
originel's Avatar
 
Join Date: Jun 2002
Location: Texas Tech
Posts: 3,921
Send a message via AIM to originel
there is a 'listboxname.additem("item name")' command you can use in conjunction with Input as #1
originel is offline   Reply With Quote
Old May 12th, 2005, 08:03 PM     #5 (permalink)
The Macedonian Member
 
njolakoski's Avatar
 
Join Date: Mar 2004
Location: Macedonia Point, IN
Posts: 3,363
Send a message via AIM to njolakoski Send a message via MSN to njolakoski Send a message via Yahoo to njolakoski
Quote:
Originally Posted by originel
there is a 'listboxname.additem("item name")' command you can use in conjunction with Input as #1

See how do i do that? I need it to add to the list
njolakoski is offline   Reply With Quote
Old May 12th, 2005, 08:18 PM     #6 (permalink)
I am a banana!
 
originel's Avatar
 
Join Date: Jun 2002
Location: Texas Tech
Posts: 3,921
Send a message via AIM to originel
here's an example:

Code:
dim myArray[arraysize]

'Code that will get the info from the file using the above methods
'i don't know how to do it off the top of my head and am too lazy to read up on it

for i = 0 to arraysize - 1
     listboxname.AddItem(myArray[i])
loop
Simple as that

(btw...better check syntax...i've been coding in C++ for the last two weeks and so I'm probably mixing the two syntax's).
originel is offline   Reply With Quote
Old May 13th, 2005, 12:16 AM     #7 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,026
I rarely use input as #1 not much control over it
Code:
Dim objFSO As FileSystemObject
Dim oInputFile as File

Set objFSO = New FileSystemObject
Set objFile = objFSO.OpenTextFile("C:\Somefile.txt", FOR_READING)

Do While Not objInputFile.AtEndOfStream
  sCurLine = Trim(objInputFile.ReadLine)
  If sCurLine <> "" Then
    lstBox.AddItem sCurLine
   End If
Loop
objInputFile.Close
Set objInputFile = Nothing
Set objFSO = Nothing
something like that, but make sure to add Scripting Runtime as a reference to get the FSO available.
vass0922 is offline   Reply With Quote
Old May 13th, 2005, 12:19 AM     #8 (permalink)
The Macedonian Member
 
njolakoski's Avatar
 
Join Date: Mar 2004
Location: Macedonia Point, IN
Posts: 3,363
Send a message via AIM to njolakoski Send a message via MSN to njolakoski Send a message via Yahoo to njolakoski
Quote:
Originally Posted by vass0922
I rarely use input as #1 not much control over it
Code:
Dim objFSO As FileSystemObject
Dim oInputFile as File

Set objFSO = New FileSystemObject
Set objFile = objFSO.OpenTextFile("C:\Somefile.txt", FOR_READING)

Do While Not objInputFile.AtEndOfStream
  sCurLine = Trim(objInputFile.ReadLine)
  If sCurLine <> "" Then
    lstBox.AddItem sCurLine
   End If
Loop
objInputFile.Close
Set objInputFile = Nothing
Set objFSO = Nothing
something like that, but make sure to add Scripting Runtime as a reference to get the FSO available.

See that looks like something ifce dones but never used al that stuff, Lets just say i havent learned anything in that Class
njolakoski is offline   Reply With Quote
Old May 13th, 2005, 12:29 AM     #9 (permalink)
Member
 
Join Date: Apr 2005
Posts: 111
Send a message via MSN to mew905
I pull off a lazy method where I load the file into a rich text box, use a bunch of loops to search for certain text, and then I do what I want with it. quite neat really
__________________
AMD Athlon 64 4000+ @ 2.6 GHz
MSI nForce4 SLI S939 @ 2000MHz FSB
OCZ 2GB PC3200 DDR RAM
BFG 256MB GeForce 7800GTX PCIe @ 460/1300
mew905 is offline   Reply With Quote
Old May 13th, 2005, 12:29 AM     #10 (permalink)
The Macedonian Member
 
njolakoski's Avatar
 
Join Date: Mar 2004
Location: Macedonia Point, IN
Posts: 3,363
Send a message via AIM to njolakoski Send a message via MSN to njolakoski Send a message via Yahoo to njolakoski
Like I remember something


Code:
Open App.Path & "\Roster.txt" For Random As #1(I think)
Line Input as #1 or something like that I cant remember at all
njolakoski is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may 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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Help? redfoxstorm Webmastering and Programming 1 February 14th, 2005 11:39 AM
HELP!! - Visual Basic darssus Webmastering and Programming 1 October 6th, 2004 02:40 PM
Visual Basic Paluccie Webmastering and Programming 32 December 16th, 2002 07:09 PM
Visual Basic kickzum General Tech Discussion 22 August 18th, 2002 01:52 PM
Visual Basic HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!! George VII Webmastering and Programming 8 May 18th, 2002 06:46 PM

Most Active Discussions
Is It Just Me? (2906)
3-days in and no threads about Gaza (161)
Misery Loves Company... (2144)
New Build ( Finally ) (7)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
RCA 52Inch HDTV wont turn on (5)
Folderchat Weekday thread (444)
Recent Discussions
Futronix has water features? (0)
Laptop proccesor to desktop mob.. (2)
Please help! multiple problems! (4)
RCA 52Inch HDTV wont turn on (5)
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 04:26 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28