textdelimiter problem (Mike A... Stick with me...)

Author Message
mikemedia

  • Total Posts : 5
  • Scores: 0
  • Reward points : 0
  • Joined: 4/13/2007
  • Status: offline
textdelimiter problem (Mike A... Stick with me...) Friday, April 13, 2007 5:06 AM (permalink)
0
Help me some more please. 

Enough dinking around.

Here's the script:

<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>

<table width="300" border="0" cellspacing="3" cellpadding="0">
<tr>
   <td valign="top" class="style1"><p>&nbsp;</p>
   </td>
   <td valign="top">&nbsp;</td>
</tr>
<tr>
   <td valign="top">&nbsp;</td>
   <td valign="top">
<asp:label runat="server" id="lblsplittext" Font-Name="Verdana" />
<%@Import Namespace="System.IO"%>
<script language="vb" runat="server">
Sub page_load(Sender As Object,e As EventArgs)
  Dim filetoread as string
  filetoread=server.mappath("readtest.txt")
  dim filestream as StreamReader
  filestream = File.Opentext(filetoread)
  Dim readcontents as String
  readcontents = fileStream.ReadToEnd()
                                                                      ORIGINALLY
                                                                             Dim textdelimiter as String
   NOW                                                                      textdelimiter = ","

  textdelimiter = CHR(9)                                    
Also tried
    textdelimiter = (CHR(9))
    textdelimiter = CHR(09)
    textdelimiter = CHR$(9)
  Dim splitout = Split(readcontents,textdelimiter)
   dim i as integer
   for i=0 to Ubound(splitout)
lblsplittext.Text &= splitout(i)& "<br>"
   next
  filestream.Close() 
End Sub
</script>
</td>
</tr>
</table>
<p>&nbsp;</p>
<p>
<%-- End of script--%>
</p>
 
 
//EDIT: changed title to reflect issue
<message edited by Snipah on Friday, April 13, 2007 5:33 PM>
 
#1
    DiGiTAL.SkReAM

    • Total Posts : 1259
    • Scores: 7
    • Reward points : 0
    • Joined: 9/7/2005
    • Location: Clearwater, FL, USA
    • Status: offline
    RE: Mike A... Stick with me partner Friday, April 13, 2007 5:15 AM (permalink)
    0
    If this is all of your code, then you are having soem pretty serious problems.
    First off, in vbscript this line:
     Dim FileToRead as String
     

     
    Doesn't work.  All variables are type Variant in vbscript.
     Dim FileToRead
     

     
    is the proper way to Dim a variable.
     
    Also, you use the "File" object, but I don't see you create it.
     Set File = CreateObject("Scripting.FileSystemObject")
     

    is the way to do it.
     
    I suggest that you take a read through the docs listed in the frist post, as you are obivously a programmer, but just not familiar with the vbscript syntax and req's.
     
    "Would you like to touch my monkey?" - Dieter (Mike Meyers)

    "It is better to die like a tiger, than to live like a pussy."
    -Master Wong, from Balls of Fury
     
    #2
      mikemedia

      • Total Posts : 5
      • Scores: 0
      • Reward points : 0
      • Joined: 4/13/2007
      • Status: offline
      RE: Mike A... Stick with me partner Friday, April 13, 2007 5:22 AM (permalink)
      0
      Mike,
       
      You're right about me being unfamialr and the script be inelegant, but it DOES work with this...  
       
      Dim textdelimiter as String
         textdelimiter = ","
       
      Every coma delimited file formats perfectly.
       
      It's just I can't interpret "TAB"
       
      Sorry if I'm a pest!
       
      #3
        dm_4ever

        • Total Posts : 3687
        • Scores: 82
        • Reward points : 0
        • Joined: 6/29/2006
        • Location: Orange County, California
        • Status: offline
        RE: Mike A... Stick with me partner Friday, April 13, 2007 5:45 AM (permalink)
        0
        Looking at this line: <script language="vb" runat="server">  it looks like you are using VB and not VBScript
        Not sure about accomplishing this with VB, but have you trief vbTab?..maybe Dim it as a contant
        Reference: http://msdn2.microsoft.com/en-us/library/f63200h0.aspx
        dm_4ever

        My philosophy: K.I.S.S - Keep It Simple Stupid
        Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
        Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          mikeock

          • Total Posts : 124
          • Scores: 1
          • Reward points : 0
          • Joined: 6/8/2006
          • Status: offline
          RE: Mike A... Stick with me partner Friday, April 13, 2007 6:50 AM (permalink)
          0
          Yeah are you tryign to run vb or vbscript?
          I know vbs but not VB!
          My sig sucks!
           
          #5
            Snipah

            • Total Posts : 1339
            • Scores: 8
            • Reward points : 0
            • Joined: 11/1/2004
            • Location: Scotland
            • Status: offline
            RE: Mike A... Stick with me partner Friday, April 13, 2007 5:29 PM (permalink)
            0
            this is more ASP....

            That should be in a different forum....
            For more information, please see the "Read me First" topic.

            http://www.visualbasicscript.com
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9