Hello people! I am making an image viewer. I load the names of my image files into a ComboBox in the Load of the form and pass them to a PictureBox in the SelectedIndexChange event of the ComboBox. all good there until I added a ToolStripStatusLabel to display the path of my file; (the only thing that changes is the name when I pass the image, because they are all in the same directory) or well, that's the idea because it occurred to me to do it this way:
private void BarradeRuta_LocationChanged(object sender, EventArgs e)
{
BarradeRuta.Text = Path.Combine(@"mi ruta....",
ComboBox1.SelectedItem.ToString());
}
but when starting the application with the debugger, it throws me an error saying that the ComboBox is throwing null.
I hope you can help, thanks in advance.
Assuming from the name that it
BarradeRuta
is theToolStripStatusLabel
, it should change its value in theSelectedIndexChange
ComboBox event.The event you are using
LocationChange
of any control occurs when its location coordinates (Location) change.Try that code from the SelectedIndexChange event of the ComboBox.