I have a problem assigning a value to a cell in a listbox.
The cells of the listbox were filled with a “¿”. The very first cell is then made editable (type 3).
HubWordList.EditCell(0,0)
HubWordList.ActiveCell.SelectAll
If I edit the cell and type in the values I have no problems with changing the value of the first cell.
I also have a method (GiveUp) where I replace all of the “¿” with correct values and it works for every cell but the first cell.
For j = 0 to MD
HubWordList.CellType(i, j) = Listbox.TypeNormal
t = HubWordList.CellType(i, j)
HubWordList.Cell(i, j) = RfrshWord(k)
k = k+1
Next//For h = 0 to MD//modulus section
[quote=396619:@Arthur Gabhart]… it works for every cell but the first cell.
For j = 0 to MD
HubWordList.CellType(i, j) = Listbox.TypeNormal
t = HubWordList.CellType(i, j)
HubWordList.Cell(i, j) = RfrshWord(k)
k = k+1
Next//For h = 0 to MD//modulus section
[/quote]
You mean the first cell of the first row, or the first cell of every row? And by not working for the first cell, do you mean it does not change at all and still has the “¿” shown?
A few things are not obvious from the limited code given:
Is variable k initialized to 0 ahead of this block?
Is the value of RfrshWord(0) something other than “¿” ?
Is variable i = 0 before this code block starts?
I’d probably add something like this ahead of k = k + 1, then add a breakpoint on that line and examine in the debugger:
dim s as string = RfrshWord(k)
Then make sure variables i, j, k, and s have the values you expect.
I probably should have added that everything works properly. The values are all changed and/or initialized properly.
k is 0 ahead of the For statement.
The cell umm indexes are correct. I use the same for statement to fill and check values elsewhere.
Just in case I had some code wrong, I did a test and the cell’s value did it’s flash when it umm wasn’t changed.
If i = 0 And j =0 Then
HubWordList.Cell(0, 0) = RfrshWord(0)
End If
Forgot to add in the first part - the celltype is normal.
t = HubWordList.CellType(i, j)
t is an integer and the celltype was correctly changed.