Results 1 to 8 of 8

Thread: [RESOLVED] Strange Listbox Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    Topsail Beach, NC
    Posts
    5

    Resolved [RESOLVED] Strange Listbox Problem

    For some reason the listbox in my application is centering the text.

    My host does not allow remote database connections, so the application is linked to a PHP file that connects to the database and runs a query, then returns the data back to the application and dynamically populates the listbox at runtime.

    Everything works exactly like I want it to, I just dont want the stuff centered in the listbox.

    Heres the VB code:

    VB Code:
    1. Private Sub Form_Load()
    2.  Dim LinkResults As String
    3.  Dim i As Integer
    4.  Dim NameResults As String
    5.  Dim x As Integer
    6.  VidStatus.Enabled = True
    7.  VidStatus.Visible = True
    8.  VidStatus.Caption = "CHOOSE A VIDEO"
    9. LinkResults = Inet1.OpenURL("http://www.xxxxxxxxxxxxxxxxxxx.com/info.php?do=getlinks")
    10.  For i = 0 To 1
    11.   VidLinks.AddItem (Split(LinkResults, "|")(i)), i
    12.  Next
    13. NameResults = Inet1.OpenURL("http://www.xxxxxxxxxxxxxxxxxxx.com/info.php?do=getnames")
    14.  For x = 0 To 1
    15.   VidNames.AddItem (Split(NameResults, "|")(x)), x
    16.  Next
    17.  
    18.   End Sub
    19.  
    20. Private Sub VidNames_Click()
    21. VidStatus.Enabled = False
    22. VidStatus.Visible = False
    23. Dim lindex As Integer
    24. lindex = VidNames.ListIndex
    25. Player.URL = VidLinks.List(lindex)
    26. End Sub

    And heres the PHP:

    PHP Code:
    include('dbConn.php');
     
    $sql=mysql_query("SELECT * FROM videos");
        while(
    $row=mysql_fetch_array($sql)) {
        
    $vid=$row["ID"];
        
    $vlink=$row["LINK"];
        
    $vname=$row["VIDNAME"];
        
    $shooter=$row["Shooter"];
        
        if(
    $_GET['do'] == "getlinks") {
        echo 
    $vlink."|";
          }
         if(
    $_GET['do'] == "getnames") {
        echo 
    $vname."|";
         }
        } 
    And heres a screenshot of the text centered:



    This is my first project with VB, any help would be greatly appreciated.
    Last edited by DA2Ricky; Jul 10th, 2006 at 10:24 AM.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Strange Listbox Problem

    thats not centered... it looks like there might be spaces?
    try

    VB Code:
    1. VidNames.AddItem Trim(Split(NameResults, "|")(x))), x
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    Topsail Beach, NC
    Posts
    5

    Re: Strange Listbox Problem

    I think you're right about the space, but that didn't work. I'll trim the PHP sent back to VB too.

    Thanks for the input!

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Strange Listbox Problem

    sure thing.. if it were centered.. the left side of the text wouldnt be lined up.. so thats what made me think it was spaces
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    Topsail Beach, NC
    Posts
    5

    Re: Strange Listbox Problem

    gotcha. It's a problem with the php, fixed.

    Thanks again.

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Strange Listbox Problem

    cool.. now .. how did u make your listbox look like that? (or form... or whatever?)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    Topsail Beach, NC
    Posts
    5

    Re: [RESOLVED] Strange Listbox Problem

    photoshop CS, then put the whole image in as a picturebox and placed the controlls over top.

    Heres the background image since you really couldn't see it all too well in the image I posted above.

    Low Quality so I don't kill 56k users (if there are any these days).

    Pretty much limited to black for the boxes until I can learn how to change the color of the actual WMP control, and listbox.

    Last edited by DA2Ricky; Jul 13th, 2006 at 09:29 PM.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    Topsail Beach, NC
    Posts
    5

    Re: [RESOLVED] Strange Listbox Problem

    I found out that somewhere in my hosts php config, it adds html tags by default.

    So whats getting printed is actually <html><head></head><body>listitem|listitem2|</body></html>

    I tried to strip the html tags within the php file, but because its in the config, it adds the tags anyway...

    So my next question would be... how can I strip them within VB?

    I tried to block the "<", ">", but apparently once their pulled into VB they are converted to some wierd chars.



    HELP!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width