L
L
Land-Maze2020-12-18 15:32:55
C++ / C#
Land-Maze, 2020-12-18 15:32:55

Incomprehensibly working listBox. Am I doing something wrong?

What's the catch?! I don't understand this morning.

Without it, it works (displays text i.e. DisplayValue) and if you add this piece to the Selected Item event, then the text turns into a class path. But displays information in Label. And with it, it can throw Exception Cast / Null

labelFrom.Text = "From : " + LogicalSystem.tempMessageMain.Single(u => u.MessageId == (int)listBoxMessages.SelectedValue).From;


List filling example

var _tempMessage = new listBoxMessage()
                {
                    strAll = LogicalSystem.MessageIn.From.Username + " [" + LogicalSystem.MessageIn.MessageId + "] : " + LogicalSystem.MessageIn.Text + " {" + 0 + "} ",
                    From = LogicalSystem.MessageIn.From.Username,
                    FromReply = "N/A",
                    FromId = LogicalSystem.MessageIn.From.Id,
                    FromIdReply = 0,
                    ReplyTo = 0,
                    ReplyToReply = 0,
                    MessageId = LogicalSystem.MessageIn.MessageId,
                    MessageIdReply = 0,
                    MessageText = LogicalSystem.MessageIn.Text,
                    Date = LogicalSystem.MessageIn.Date,
                    DateReply = LogicalSystem.MessageIn.Date
                };
 
                    tempMessageMain.Add(_tempMessage);


.net framework

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question