You have got to check yourself: you are allowing a user to enter a number, which you hope is within the range of the checked list box. If the user enters "749" and you only have five items, then yes - you will be out of range.
So check your user input. Report problems to the user so he can correct them instead of blindly continuing to work with bad information!
private void button3_Click(object sender, EventArgs e)
{
int im;
if (!int.TryParse(textBox1.Text, out im))
{
MessageBox.Show(string.Format("\"{0}\" is not a valid number.", textBox1.Text);
return;
}
if (im == 0 || im > checkedListBox2.SelectedItems.Count)
{
MessageBox.Show(string.Format("\"{0}\" is does not refer to an item", textBox1.Text);
return;
}
this.Text = checkedListBox2.SelectedItems[im - 1].ToString();
}