1 Attachment(s)
[RESOLVED] Getting black blocks after Item entry in ListBox if Windows XP is being used
I've been testing an application I'm working on in Windows 7, Vista and XP. If I'm using XP then I get a couple of solid black blocks after the items listed in the ListBox. They are absent when running the same application in Vista or 7. I have the enable application framework checkbox unchecked. I haven't tried changing that to see if it makes a difference.
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
how do you add the items to the listbox + where do you get them from?
can you show us your code?
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
those blocks are unprintable or non visual characters.
are the entries null terminated strings?
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
Here's the Sub that checks to see what saved screens are in a particular series and then populates the ListBox with those screens. I chopped out some of the nonessential code that would be completely unrelated to the ListBox.
Code:
Sub FindSavedScreensForSeries()
adec = 0 ' generic variable used to upwardly increment ScreenNumber
bd1 = 1 ' generic variable used to increment bd by either 1 or 0.1
bd2 = 0 ' generic variable used to count how many times no file is found if integer values are used for bd
st1 = ""
a = 1
Do Until StringForListBox(a) = "" ' empty array
StringForListBox(a) = ""
a += 1
Loop
a = 1
Do
If File.Exists(PathToPersonalScreens & "\" & Folder4PS & "\" & IDCodewDashOrN & "Series" & Series & "ScreenNumber" & adec & ".txt") Then
StringForListBox(a) = "Series " & Series & " ScreenNumber " & adec & R
a += 1
bd2 = 0
Else
bd2 += 1
End If
adec = CDec(adec + 0.01)
Loop Until bd2 > 2500 ' will show screens spaced 25 apart but not more
ListBoxDisplaySavedScreens.Items.Clear()
If StringForListBox(1) = "" Then
ListBoxDisplaySavedScreens.SelectionMode = SelectionMode.None
LblListBoxMessageScreens.Text = ""
LblDeleteMessage.Visible = False
Else
a = 1
Do Until StringForListBox(a) = ""
ListBoxDisplaySavedScreens.Items.Add(StringForListBox(a))
a += 1
Loop
ListBoxDisplaySavedScreens.SelectionMode = SelectionMode.MultiExtended
End If
End Sub
I created another project from scratch and added a ListBox and this code.
Code:
Dim StringForListBox(9) As String
Dim a As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
StringForListBox(1) = "Series 1 ScreenNumber 1"
StringForListBox(2) = "Series 1 ScreenNumber 2"
StringForListBox(3) = "Series 1 ScreenNumber 3"
a = 1
ListBoxDisplaySavedScreens.Items.Clear()
Do Until StringForListBox(a) = ""
ListBoxDisplaySavedScreens.Items.Add(StringForListBox(a))
a += 1
Loop
End Sub
I created an install program using InstallShield just like I did for the other and then installed it into XP and I don't see the black blocks. Don't know what the difference is. I had enable application framework disabled just like for the other application. I think I have all the properties matched between the 2 ListBoxes in the different applications. I'll go back over them.
Here's a separate question. In the above Sub at the top of this post I manually empty an array out setting the separate elements to "". Is there a way to empty an array using some function that's built into Visual Basic 2010?
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
Quote:
Code:
StringForListBox(a) = "Series " & Series & " ScreenNumber " & adec & R
what is R?
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
I just saw your post # 3 after I made post number 4.
Code:
Public R As String = Environment.NewLine
After I read post # 3 I realized I didn't do a good test in my test application I just created. I should have included R in the strings but I didn't. I'll do another test with R.
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
that will be the problem then. just rebuild without the Environment.NewLine's
1 Attachment(s)
Re: Getting black blocks after Item entry in ListBox if Windows XP is being used
Each string is a separate item in the ListBox so they aren't necessary at all. My first test application proved that. I redid the test application with R and this is what it looked like in XP. It's a larger font so you can see better what it looks like. When you said rebuild without Environment.NewLine, I thought about it and see that they were never necessary.