[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:
Private Sub Form_Load()
Dim LinkResults As String
Dim i As Integer
Dim NameResults As String
Dim x As Integer
VidStatus.Enabled = True
VidStatus.Visible = True
VidStatus.Caption = "CHOOSE A VIDEO"
LinkResults = Inet1.OpenURL("http://www.xxxxxxxxxxxxxxxxxxx.com/info.php?do=getlinks")
For i = 0 To 1
VidLinks.AddItem (Split(LinkResults, "|")(i)), i
Next
NameResults = Inet1.OpenURL("http://www.xxxxxxxxxxxxxxxxxxx.com/info.php?do=getnames")
For x = 0 To 1
VidNames.AddItem (Split(NameResults, "|")(x)), x
Next
End Sub
Private Sub VidNames_Click()
VidStatus.Enabled = False
VidStatus.Visible = False
Dim lindex As Integer
lindex = VidNames.ListIndex
Player.URL = VidLinks.List(lindex)
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:
http://www.runandgunaction.com/screen.jpg
This is my first project with VB, any help would be greatly appreciated.
Re: Strange Listbox Problem
thats not centered... it looks like there might be spaces?
try
VB Code:
VidNames.AddItem Trim(Split(NameResults, "|")(x))), x
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!
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
Re: Strange Listbox Problem
gotcha. It's a problem with the php, fixed.
Thanks again.
Re: [RESOLVED] Strange Listbox Problem
cool.. now .. how did u make your listbox look like that? (or form... or whatever?)
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.
http://www.runandgunaction.com/ss2.jpg
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.
http://www.runandgunaction.com/ss.jpg
HELP!!