GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Visual Basic help needed! (https://gfy.com/showthread.php?t=584883)

More Booze 03-09-2006 03:27 PM

Visual Basic help needed!
 
Code:

Open "c:\stuff\content.txt" For Input As #1
  Do

        Input #1, texten
        If texten <> "" Then
           
            List1.AddItem texten
        End If
    Loop Until EOF(1)
   
Close #1

The problem is that each time the textline contains a comma "," it adds a new line to the listbox. I tried to fix it with this code.

Code:

texten = Replace(texten, Chr(44), "hahaha44")  <-- (special HTML chr for comma.)
But it doesn't work. How do I solve this?

More Booze 03-09-2006 03:52 PM

*bump*****

SilverTab 03-09-2006 04:00 PM

huh weird! I wonder why a coma is causing a new line??

BTW im not that familiar with vb but is:
Input #1, texten

the same as

Line Input #1, texten???

Line input should grab all the text untill it meets a linefeed...so coma shoulnt be a prob?... I dunno...

More Booze 03-09-2006 04:03 PM

Hey! I just changed it to
Line Input #1, texten
and it worked! Thanks! :-)

SilverTab 03-09-2006 04:15 PM

no prob :)


glad I could help ;)

Myst 03-09-2006 05:08 PM

Private Sub LoadContents(Lst As Object, sPath As String)
Dim iFN As Integer
Dim sEntry As String
Lst.Clear 'clear the list
iFN = FreeFile ' get a free filenumber
Open sPath For Input As iFN ' open the file
Do Until EOF(iFN) ' loop until end of file (EOF) reached
Line Input #iFN, sEntry ' get the next entry
Lst.AddItem sEntry ' add entry to the list
Loop
Close iFN ' close the file
End Sub


All times are GMT -7. The time now is 03:39 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123