Visual Basic .Net List Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem with a list box on a form. I have a list box that when
I add items to it the text does not show up in the list box. I know thy are
added because the side scroll bar changes and I can scrolll throught the list
box. I can not figure out why the items are not being displayed. I have
checked that the background color and the text color are different. Please
let me know what else could be wrong
 
Show the newsgroup the code you have & we'll see where you are going wrong
 
Are you positive you're adding type "text" to it? The listbox.items.add
method accepts a type "object" so it wouldn't produce an error if you tried
to add something that was not text. Could you provide some code from your
application?

-Jason
 
Here is the code I was testing with.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
End Sub
 
Nothing wrong with that as far as I can see. Definately weird. If I think
of anything, I'll post back. I'm not sure if any kind of system font
changes or anything would affect it or not.

Try doing ListBox1.Items.Add(New String("Hello"))

That will most likely come up with the same result, but it's worth a shot.
Sorry I can't be of more help on this one.

-Jason
 
Here is the code I was testing with.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
ListBox1.Items.Add("HELLO")
End Sub

The code is fine. If you've been playing with the properties, check to
make sure DrawMode is set to normal. Thats the only thing I can find
that produces those results (Scrollbars showing, but no text)

MP
 
Hank1234 said:
I am having a problem with a list box on a form. I have a list box that
when
I add items to it the text does not show up in the list box. I know thy
are
added because the side scroll bar changes and I can scrolll throught the
list
box. I can not figure out why the items are not being displayed. I have
checked that the background color and the text color are different.

Maybe the problem is caused by an unpatched virus scanner. These symptoms
are typically caused by a McAfee VirusScan problem that NAI is aware of and
that can be fixed by installing a patch:

Patch 5 for McAfee VirusScan Enterprise 8.0i
<URL:https://knowledgemap.nai.com/phpclient/viewKDoc.aspx?url=kb/kb_kb38717.xml&docType=DOC_KnowledgeBase>
 
I have tried the "ListBox1.Items.Add(New String("Hello"))" code but it
produces the same result of no text but the scroll bars show up. I have also
checked the properties of the list box and the DrawMode is set to "Normal".
Even if I manually change the items (before runtime) it does the same thing.
Any other ideas?
 
Thank you for the link, we are running McAfee VirusScan Enterprise 8.0i
and it is fairly new to the enviroment. I will guess that this is the
problem and will see why we do not allready have this patch. Thanks again.
 
Did you try removing the listbox from the form & then adding a new one. It
will keep the same default name, so, you won't need to alter your code. Does
that make any difference?

McAfee lets viruses through.. Symantec Antivirus 9.0 Corporate Edition is
far better!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top